﻿var myTree = [
    {
        "id": 1,
        "pid": 0,
        "name": "仓储物流科",
    },
    {
        "id": 2,
        "pid": 1,
        "name": "原材料罐区",
    },
    {
        "id": 3,
        "pid": 0,
        "name": "动力车间",
    },
    {
        "id": 4,
        "pid": 3,
        "name": "煤制氢装置",
    }
];

function randomTreeNode(tree, pid, b) {
    var result = '';
    var tempArray = [];
    if (!b) {
        var idArray = [];
        var pidArray = [];
        tree.forEach(function (v, i) {
            if (pid) {
                if (pid == v.pid) {
                    idArray.push(v.id);
                    pidArray.push(v.pid);
                }
            }
            else {
                idArray.push(v.id);
                pidArray.push(v.pid);
            }
        })
        tempArray = idArray.filter(function (v) { return pidArray.indexOf(v) === -1 });
        result = tempArray[Math.floor(Math.random() * tempArray.length)] + '';
    }
    else {
        tree.forEach(function (v, i) {
            if (v.pid + '' == '0') {
                tempArray.push(v.id);
            }
        })
        result = tempArray[Math.floor(Math.random() * tempArray.length)] + '';
    }
    return result;
}

var SpecialJobSelection = [
    {
        "id": 13,
        "pid": 0,
        "name": "特殊作业",
    },
    {
        "id": 13 - 1,
        "pid": 13,
        "name": "吊装（一般）",
    },
    {
        "id": 13 - 2,
        "pid": 13,
        "name": "吊装（简易）",
    },
    {
        "id": 13 - 3,
        "pid": 13,
        "name": "动火",
    },
    {
        "id": 16 - 1,
        "pid": 13,
        "name": "动土",
    },
    {
        "id": 16 - 2,
        "pid": 13,
        "name": "管线设备打开",
    }
];

//工作类型编辑页

var $WorkType = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {

            case '/api/WorkType/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($WorkType.WorkTypelist.length == 0) {
                        $WorkType.InitArray();
                    }


                    var p = JSON.parse(options.body);
                    //条件

                    //分页
                    var offset = p.offset;
                    var limit = p.limit;

                    var limitUsers = [];
                    for (var i = 0; i < $WorkType.WorkTypelist.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push($WorkType.WorkTypelist[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: $WorkType.WorkTypelist.length }
                    };
                }); break;

        }
    },
    WorkTypelist: [],
    InitArray: function () {
        for (var i = 0; i < 9; i++) {
            $WorkType.WorkTypelist.push(Mock.mock({
                //id: Mock.Random.id(),
                WorkTypeName: getDicValue('04', i),
                //remarks: Mock.Random.cname()
            }));
        }
    }
}
//危害识别编辑页
var $HazardIdentification = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {

            case '/api/HazardIdentification/GetList': Mock.mock(host + url, type,
                function (options) {

                    if ($HazardIdentification.WorkTypelist.length == 0) {
                        $HazardIdentification.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件

                    //分页
                    var offset = p.offset;
                    var limit = p.limit;

                    var limitUsers = [];
                    for (var i = 0; i < $HazardIdentification.WorkTypelist.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push($HazardIdentification.WorkTypelist[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: $HazardIdentification.WorkTypelist.length }
                    };
                }); break;

        }
    },
    WorkTypelist: [],
    InitArray: function () {
        for (var i = 0; i < 9; i++) {
            $HazardIdentification.WorkTypelist.push(Mock.mock({
                id: Mock.Random.id(),
                HazardIdentificationName: getDicValue('05', i),
                remarks: Mock.Random.cname()
            }));
        }
    }
}


//个人安全防护编辑页
var $PersonalSecurityProtection = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {

            case '/api/PersonalSecurityProtection/GetList': Mock.mock(host + url, type,
                function (options) {

                    if ($PersonalSecurityProtection.WorkTypelist.length == 0) {
                        $PersonalSecurityProtection.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件

                    //分页
                    var offset = p.offset;
                    var limit = p.limit;

                    var limitUsers = [];
                    for (var i = 0; i < $PersonalSecurityProtection.WorkTypelist.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push($PersonalSecurityProtection.WorkTypelist[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: $PersonalSecurityProtection.WorkTypelist.length }
                    };
                }); break;

        }
    },
    WorkTypelist: [],
    InitArray: function () {
        for (var i = 0; i < 9; i++) {
            $PersonalSecurityProtection.WorkTypelist.push(Mock.mock({
                id: Mock.Random.id(),
                PersonalSecurityProtectionName: getDicValue('06', i),
                remarks: Mock.Random.cname()
            }));
        }
    }
}



//工作前安全措施编辑页
var $PreworkSafetyMeasures = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {

            case '/api/PreworkSafety/GetList': Mock.mock(host + url, type,
                function (options) {

                    if ($PreworkSafetyMeasures.WorkTypelist.length == 0) {
                        $PreworkSafetyMeasures.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件

                    //分页
                    var offset = p.offset;
                    var limit = p.limit;

                    var limitUsers = [];
                    for (var i = 0; i < $PreworkSafetyMeasures.WorkTypelist.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push($PreworkSafetyMeasures.WorkTypelist[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: $PreworkSafetyMeasures.WorkTypelist.length }
                    };
                }); break;
        }
    },
    WorkTypelist: [],
    InitArray: function () {
        for (var i = 0; i < 9; i++) {
            $PreworkSafetyMeasures.WorkTypelist.push(Mock.mock({
                id: Mock.Random.id(),
                PreworkSafetyMeasuresName: getDicValue('07', i),
                remarks: Mock.Random.cname()
            }));
        }
    }
}
//F_安全措施确认
var $F_PreworkSafetyMeasures = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {

            case '/api/F_PreworkSafetyMeasures/GetList': Mock.mock(host + url, type,
                function (options) {

                    if ($F_PreworkSafetyMeasures.WorkTypelist.length == 0) {
                        $F_PreworkSafetyMeasures.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件

                    //分页
                    var offset = p.offset;
                    var limit = p.limit;

                    var limitUsers = [];
                    for (var i = 0; i < $F_PreworkSafetyMeasures.WorkTypelist.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push($F_PreworkSafetyMeasures.WorkTypelist[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: $F_PreworkSafetyMeasures.WorkTypelist.length }
                    };
                }); break;

        }
    },
    WorkTypelist: [],
    InitArray: function () {
        for (var i = 0; i < 5; i++) {
            $F_PreworkSafetyMeasures.WorkTypelist.push(Mock.mock({
                id: Mock.Random.id(),
                PreworkSafetyName: getDicValue('17', i),
                remarks: Mock.Random.cname()
            }));
        }
    }
}

//作业许可证列表
var $JobLicenseManagement = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;

        switch (url) {
            case '/api/JobLicenseManagement/GetList': Mock.mock(host + url, type,
                function (options) {

                    if ($JobLicenseManagement.WorkTypelist.length == 0) {
                        $JobLicenseManagement.InitArray();
                    }

                    var p = JSON.parse(options.body);
                    //条件
                    var JobLicenseCode = p.model.JobLicenseCode;
                    var JobLicenseUnit = p.model.JobLicenseUnit;
                    var JobLicensePeople = p.model.JobLicensePeople;

                    //分页
                    var offset = p.offset;
                    var limit = p.limit;

                    var limitUsers2 = [];
                    for (var i = 0; i < $JobLicenseManagement.WorkTypelist.length; i++) {
                        var user = $JobLicenseManagement.WorkTypelist[i];
                        if (JobLicenseCode && user.JobLicenseCode.indexOf(JobLicenseCode) == -1)
                            continue;
                        if (JobLicenseUnit && user.JobLicenseUnit.indexOf(JobLicenseUnit) == -1)
                            continue;
                        if (JobLicensePeople && user.JobLicensePeople.indexOf(JobLicensePeople) == -1)
                            continue;
                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }

                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: $JobLicenseManagement.WorkTypelist.length }
                    };
                }); break;
            case '/api/JobLicenseManagement/get': Mock.mock(host + url + '?' + param, type, function (options) {
                var myUsers = parent.$JobLicenseManagement.WorkTypelist;
                myuser = {};
                var bool = true;
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        bool = false;
                        break;
                    }
                }
                if (bool) {
                    myuser.JobLicenseCode = Mock.Random.id();
                    myuser.ApplicationTime = Mock.mock('@date()');
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;

            ////提交
            case '/api/JobLicenseManagement/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$JobLicenseManagement.WorkTypelist;
                console.log(123)
                console.log(thisuser)
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].JobLicenseCode = Mock.Random.id();//"作业许可证编号",
                        thisUsers[i].JobLicenseUnit = Mock.Random.cname();//"作业申请单位",
                        thisUsers[i].JobLicensePeople = Mock.Random.cname();//"作业申请人",
                        thisUsers[i].OperatingUnit = thisuser.OperatingUnit;//"作业单位",
                        thisUsers[i].JobManagerProple = thisuser.JobManagerProple;//"作业负责人",
                        thisUsers[i].JobLocation = thisuser.JobLocation;//作业地点
                        thisUsers[i].PeopleWork = thisuser.PeopleWork;//作业人
                        thisUsers[i].Guardian = thisuser.Guardian;//监护人
                        thisUsers[i].workDescription = thisuser.workDescription;//工作描述
                        thisUsers[i].DrawingDescription = thisuser.DrawingDescription;//图纸说明
                        thisUsers[i].CheckJobType = thisuser.CheckJobType;//工作类型
                        thisUsers[i].CheckHazardIdentification = thisuser.CheckHazardIdentification;//危害识别
                        thisUsers[i].CheckPersonalSecurityProtection = thisuser.CheckPersonalSecurityProtection;//个人安全防护
                        thisUsers[i].CheckPreworkSafetyMeasures = thisuser.PreworkSafetyMeasures;//工作前安全措施（工作区域准备）：   
                        thisUsers[i].CheckF_PreworkSafetyMeasures = thisuser.CheckF_PreworkSafetyMeasures;///安全措施确认 
                        thisUsers[i].WorkRegion = thisuser.WorkRegion;///工作区域 
                        thisUsers[i].WorkRegionA = thisuser.WorkRegionA;///工作区域 
                        thisUsers[i].ContractorList = thisuser.ContractorList;///承包商 
                        thisUsers[i].JobApproverDepartment = thisuser.JobApproverDepartment;//作业审批人（部门）
                        thisUsers[i].JobApprover = thisuser.JobApprover;///作业审批人（部门）
                        thisUsers[i].TerritorialSupervisorDepartment = thisuser.TerritorialSupervisorDepartment;/////属地主管：（部门）
                        thisUsers[i].TerritorialSupervisorPeople = thisuser.TerritorialSupervisorPeople;//属地主管：
                        thisUsers[i].AffectedParties = thisuser.AffectedParties;///受影响相关放
                        thisUsers[i].SpecialWorkPermitTable = thisuser.SpecialWorkPermitTable;////特殊票证
                        thisUsers[i].JobLicenseStatic = getDicValue('18', i);// 许可证状态
                        thisUsers[i].EffectiveStartTime = Mock.Random.date();//有效起始时间
                        thisUsers[i].EffectiveEndTime = Mock.Random.date();//有效截至时间
                        thisUsers[i].Attachment = thisuser.Attachment;//附件
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    var WorkAreaPidA = randomTreeNode(WordAreaTree, '0', true);
                    var WorkAreaIdA = randomTreeNode(WordAreaTree, WorkAreaPidA);
                    var PersonInChargePidA = randomTreeNode(PersonInChargeTree, '0', true);
                    var PersonInChargeIdA = randomTreeNode(PersonInChargeTree, PersonInChargePidA);
                    parent.$JobLicenseManagement.WorkTypelist.push({
                        id: Mock.Random.id(),

                        ApplicationTime: thisuser.ApplicationTime,
                        JobLicenseCode: Mock.Random.id(),
                        JobLicenseUnit: Mock.Random.cname(),
                        JobLicensePeople: Mock.Random.cname(),
                        OperatingUnit: thisuser.OperatingUnit, //"作业单位"
                        JobManagerProple: thisuser.JobManagerProple,//"作业负责人"
                        JobLocation: thisuser.JobLocation,//作业地点
                        PeopleWork: thisuser.PeopleWork,//作业人
                        Guardian: thisuser.Guardian,//监护人
                        workDescription: thisuser.workDescription,//工作描述
                        DrawingDescription: thisuser.DrawingDescription,//图纸说明
                        CheckJobType: thisuser.CheckJobType,//工作类型
                        CheckHazardIdentification: thisuser.CheckHazardIdentification,//危害识别
                        CheckPersonalSecurityProtection: thisuser.CheckPersonalSecurityProtection,//个人安全防护
                        CheckPreworkSafetyMeasures: thisuser.CheckPreworkSafetyMeasures,//工作前安全措施（工作区域准备）：
                        CheckF_PreworkSafetyMeasures: thisuser.CheckF_PreworkSafetyMeasures,///安全措施确认
                        WorkRegion: WorkAreaIdA,///工作区域

                        ContractorList: thisuser.ContractorList,///承包商
                        //   JobApproverDepartment: thisuser.JobApproverDepartment,//作业审批人（部门）
                        JobApprover: PersonInChargeIdA,///作业审批人（部门）
                        // TerritorialSupervisorDepartment: thisuser.TerritorialSupervisorDepartment,/////属地主管：（部门）
                        TerritorialSupervisorPeople: PersonInChargeIdA,//属地主管：
                        AffectedParties: thisuser.AffectedParties,///受影响相关放
                        SpecialWorkPermitTable: thisuser.SpecialWorkPermitTable,////特殊票证
                        JobLicenseStatic: getDicValue('18', i),// 许可证状态
                        EffectiveStartTime: Mock.Random.date(),//有效起始时间
                        EffectiveEndTime: Mock.Random.date(),//有效截至时间
                        Attachment: thisuser.Attachment///附件
                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    WorkTypelist: [],
    InitArray: function () {
        for (var i = 0; i < 9; i++) {
            var PersonInChargePidA = randomTreeNode(PersonInChargeTree, '0', true);
            var PersonInChargeIdA = randomTreeNode(PersonInChargeTree, PersonInChargePidA);
            var WorkAreaPidA = randomTreeNode(WordAreaTree, '0', true);
            var WorkAreaIdA = randomTreeNode(WordAreaTree, WorkAreaPidA);
            $JobLicenseManagement.WorkTypelist.push(Mock.mock({
                id: Mock.Random.id(),
                ApplicationTime: Mock.mock('@date()'),
                JobLicenseCode: Mock.Random.id(),//"作业许可证编号",
                JobLicenseUnit: Mock.Random.cname(),//"作业申请单位",
                JobLicensePeople: Mock.Random.cname(),//"作业申请人",
                OperatingUnit: Mock.Random.cname(),//z作业单位
                JobManagerProple: Mock.Random.cname(),//作业负责人
                JobLocation: randomValue("97"),//作业地点
                PeopleWork: Mock.Random.cname(),//作业人
                Guardian: Mock.Random.cname(),//监护人
                workDescription: Mock.Random.cname(),//工作描述
                DrawingDescription: Mock.Random.cname(),//图纸说明
                WorkRegion: WorkAreaIdA,//工作区域

                ContractorList: randomValue("12"),//承包商
                //   JobApproverDepartment: randomValue("14"),//作业审批人（部门）
                JobApprover: PersonInChargeIdA,//作业审批人
                //  TerritorialSupervisorDepartment: randomValue("15"),//属地主管：（部门）
                TerritorialSupervisorPeople: PersonInChargeIdA,//属地主管：
                AffectedParties: [{ unit: randomValue('08'), unitPeople: randomValue('09') }],//受影响相关放
                SpecialWorkPermitTable: [{ JobTicketName: Mock.Random.cname(), JobTicketCode: Mock.Random.cname() }],//特殊票证
                JobLicenseStatic: getDicValue('18', i),       // 许可证状态
                EffectiveStartTime: Mock.Random.date(),//有效起始时间
                EffectiveEndTime: Mock.Random.date(),//有效截至时间
                Attachment: [{ AttachmentName: Mock.Random.cname(), AttachmentUploadTime: Mock.Random.date() }],//附件,
                CheckJobType: randomValue("04", 3),
                CheckHazardIdentification: randomValue("05", 2),//危害意识选中
                CheckPersonalSecurityProtection: randomValue("06", 2),//个人安全防护选中
                CheckPreworkSafetyMeasures: randomValue("07", 2),//工作前安全措施（工作区域准备）选中
                CheckF_PreworkSafetyMeasures: randomValue("17", 2),//安全措施确认  选中

            }));
        }
    }
}


//特殊作业选择
var $SpecialJobSelection = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {

            case '/api/SpecialJobSelection/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($SpecialJobSelection.WorkTypelist.length == 0) {
                        $SpecialJobSelection.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var JobTicketName = p.model.JobTicketName;
                    var JobTicketCode = p.model.JobTicketCode;
                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers = [];
                    var limitUsers2 = [];
                    var TreeNode = p.model.TreeNode;
                    for (var i = 0; i < $SpecialJobSelection.WorkTypelist.length; i++) {
                        var user = $SpecialJobSelection.WorkTypelist[i];
                        if (JobTicketName && user.JobTicketName.indexOf(JobTicketName) == -1)
                            continue;
                        if (JobTicketCode && user.JobTicketCode.indexOf(JobTicketCode) == -1)
                            continue;
                        if (TreeNode && user.TreeNode.indexOf(TreeNode) == -1)
                            continue;
                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }

                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;

        }
    },
    WorkTypelist: [],
    InitArray: function () {
        for (var i = 0; i < 16; i++) {
            $SpecialJobSelection.WorkTypelist.push(Mock.mock({
                ApplicationTime: Mock.mock('@date()'),
                JobTicketName: getDicValue('25', i),
                JobTicketCode: Mock.mock('@id'),
                TreeNode: randomTreeNode(SpecialJobSelection)
            }));
        }
    }
}

//作业中类型
var $OperationTypeMaintain = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/OperationTypeMaintain/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $OperationTypeMaintain.EquipmenFacilities.length; i++) {
                    temp.push($OperationTypeMaintain.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $OperationTypeMaintain.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/OperationTypeMaintain/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($OperationTypeMaintain.EquipmenFacilities.length == 0) {
                        $OperationTypeMaintain.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var TypeName = p.model.TypeName;
                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $OperationTypeMaintain.EquipmenFacilities.length; i++) {
                        var user = $OperationTypeMaintain.EquipmenFacilities[i];
                        if (TypeName && user.TypeName.indexOf(TypeName) == -1)
                            continue;
                        user.TypeName = getDicValue("81", user.TypeName) == '' ? user.TypeName : getDicValue("81", user.TypeName);
                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
            ////获取Input数据
            case '/api/OperationTypeMaintain/get': Mock.mock(host + url + '?' + param, type, function (options) {

                var myUsers = parent.$OperationTypeMaintain.EquipmenFacilities;
                myuser = {};
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        break;
                    }
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            ////提交
            case '/api/OperationTypeMaintain/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$OperationTypeMaintain.EquipmenFacilities;
                var cz = true;

                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].TypeName = thisuser.TypeName;
                        thisUsers[i].SortNumber = thisuser.SortNumber;
                        thisUsers[i].Remarks = thisuser.Remarks;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    //Input 页面需要 去操作List页面的数组 parent
                    parent.$OperationTypeMaintain.EquipmenFacilities.push({
                        id: Mock.Random.id(),
                        TypeName: thisuser.TypeName,
                        SortNumber: thisuser.SortNumber,
                        Remarks: thisuser.Remarks,


                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 9; i++) {
            $OperationTypeMaintain.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                TypeName: getDicValue('81', i),
                SortNumber: i,//区域
                Remarks: Mock.mock('@cparagraph(1, 1)')//承包商名称
            }));
        }
    }
}
//作业基本信息配置
var $BasicJobInformation = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/BasicJobInformation/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $BasicJobInformation.EquipmenFacilities.length; i++) {
                    temp.push($BasicJobInformation.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $BasicJobInformation.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/BasicJobInformation/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($BasicJobInformation.EquipmenFacilities.length == 0) {
                        $BasicJobInformation.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var ValidityPeriod = p.model.ValidityPeriod;
                    var TypeName = getDicValue("81", p.model.TypeName);
                    var Level = getDicValue("03", p.model.Level);
                    var OtherFormsRequired = getDicValue("83", p.model.OtherFormsRequired);
                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $BasicJobInformation.EquipmenFacilities.length; i++) {
                        var user = $BasicJobInformation.EquipmenFacilities[i];
                        if (TypeName && user.TypeName.indexOf(TypeName) == -1)
                            continue;
                        if (ValidityPeriod && user.ValidityPeriod.indexOf(ValidityPeriod) == -1)
                            continue;
                        if (Level && user.Level.indexOf(Level) == -1)
                            continue;
                        if (OtherFormsRequired && user.OtherFormsRequired.indexOf(OtherFormsRequired) == -1)
                            continue;
                        user.TypeName = getDicValue("81", user.TypeName) == '' ? user.TypeName : getDicValue("81", user.TypeName);
                        user.Level = getDicValue("03", user.Level) == '' ? user.Level : getDicValue("03", user.Level);
                        user.OtherFormsRequired = getDicValue("83", user.OtherFormsRequired) == '' ? user.OtherFormsRequired : getDicValue("83", user.OtherFormsRequired);
                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
            ////获取Input数据
            case '/api/BasicJobInformation/get': Mock.mock(host + url + '?' + param, type, function (options) {

                var myUsers = $BasicJobInformation.EquipmenFacilities;
                //行内  去掉.parent
                myuser = {};
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        break;
                    }
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            ////提交
            case '/api/BasicJobInformation/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = $BasicJobInformation.EquipmenFacilities;
                //行内  去掉.parent
                var cz = true;

                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].TypeName = thisuser.TypeName;
                        thisUsers[i].Level = thisuser.Level;
                        thisUsers[i].ValidityPeriod = thisuser.ValidityPeriod;
                        thisUsers[i].OtherFormsRequired = thisuser.OtherFormsRequired;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    //Input 页面需要 去操作List页面的数组 parent
                    $BasicJobInformation.EquipmenFacilities.unshift({
                        //行内  去掉.parent
                        id: Mock.Random.id(),
                        TypeName: thisuser.TypeName,
                        Level: thisuser.Level,
                        ValidityPeriod: thisuser.ValidityPeriod,
                        OtherFormsRequired: thisuser.OtherFormsRequired,

                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 30; i++) {
            $BasicJobInformation.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                TypeName: randomValue("81"),
                Level: randomValue("03"),//区域
                ValidityPeriod: i + "小时",//承包商名称
                OtherFormsRequired: randomValue("83")
            }));
        }
    }
}
//JSA分析管理
var $JSPAnalyticalManagement = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/JSPAnalyticalManagement/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $JSPAnalyticalManagement.EquipmenFacilities.length; i++) {
                    temp.push($JSPAnalyticalManagement.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $JSPAnalyticalManagement.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/JSPAnalyticalManagement/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($JSPAnalyticalManagement.EquipmenFacilities.length == 0) {
                        $JSPAnalyticalManagement.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var ApplicationNumber = p.model.ApplicationNumber;
                    var OperatingUnit = p.model.OperatingUnit;
                    var JobManagere = p.model.JobManagere;
                 
                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $JSPAnalyticalManagement.EquipmenFacilities.length; i++) {
                        var user = $JSPAnalyticalManagement.EquipmenFacilities[i];
                        if (ApplicationNumber && user.ApplicationNumber.indexOf(ApplicationNumber) == -1)
                            continue;
                        if (OperatingUnit && user.OperatingUnit.indexOf(OperatingUnit) == -1)
                            continue;
                        if (JobManagere && user.JobManagere.indexOf(JobManagere) == -1)
                            continue;
                        user.Approver = getDicValue("16", user.Approver) == '' ? user.Approver : getDicValue("16", user.Approver);

                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
            ////获取Input数据
            case '/api/JSPAnalyticalManagement/get': Mock.mock(host + url + '?' + param, type, function (options) {
                var myUsers = parent.$JSPAnalyticalManagement.EquipmenFacilities;
                myuser = {};
                var b = true
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        b = false;
                        break;
                    }
                }
                if (b) {
                    myuser.ParticipateJSPAnalysts = [];
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            case '/api/JSPAnalyticalManagement/getRish': Mock.mock(host + url + '?' + param, type, function (options) {
                var id = parent.app.Form.RiskIdentificationSafety;
                var myuser = {
                    OperationRelatedActivitiesRish: [], ActivityRish: [], OperatingProcedureRish: [], InspectionMaintenanceActivitiesRish: [],
                    EquipmentFacilitiesRish: [], ProcessMediumRish: [], PlaceEnvironmentRish: []
                };
                for (var i = 0; i < id.length; i++) {
                    if (id[i].RiskTypeId == 0) {
                        myuser.OperationRelatedActivitiesRish.push(id[i]);
                        continue;
                    } else if (id[i].RiskTypeId == 1) {
                        myuser.ActivityRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 2) {
                        myuser.OperatingProcedureRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 3) {
                        myuser.InspectionMaintenanceActivitiesRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 4) {
                        myuser.EquipmentFacilitiesRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 5) {
                        myuser.ProcessMediumRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 6) {
                        myuser.PlaceEnvironmentRish.push(id[i]);
                        continue;
                    }
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;

            ////提交
            case '/api/JSPAnalyticalManagement/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$JSPAnalyticalManagement.EquipmenFacilities;
                var cz = true;

                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].OperatingUnit = thisuser.OperatingUnit;
                        thisUsers[i].ApplicationNumber = thisuser.ApplicationNumber;
                        thisUsers[i].ApplicationTime = thisuser.ApplicationTime;
                        thisUsers[i].JobManagere = thisuser.JobManagere;
                        thisUsers[i].Approver = thisuser.Approver;
                        thisUsers[i].WorkDescription = thisuser.WorkDescription;
                        thisUsers[i].PersonalProtectiveEquipment = thisuser.PersonalProtectiveEquipment;
                        thisUsers[i].RiskIdentificationSafety = thisuser.RiskIdentificationSafety;
                        thisUsers[i].ParticipateJSPAnalysts = thisuser.ParticipateJSPAnalysts;
                        //   thisUsers[i].JobApproverDepartment = thisuser.JobApproverDepartment;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    var PersonInChargePidA = randomTreeNode(PersonInChargeTree, '0', true);
                    var PersonInChargeIdA = randomTreeNode(PersonInChargeTree, PersonInChargePidA);
                    //Input 页面需要 去操作List页面的数组 parent
                    parent.$JSPAnalyticalManagement.EquipmenFacilities.push({
                        id: Mock.Random.id(),
                        OperatingUnit: thisuser.OperatingUnit,
                        ApplicationNumber: thisuser.ApplicationNumber,
                        ApplicationTime: thisuser.ApplicationTime,
                        JobManagere: PersonInChargeIdA,
                        Approver: thisuser.Approver,
                        WorkDescription: thisuser.WorkDescription,
                        PersonalProtectiveEquipment: thisuser.PersonalProtectiveEquipment,
                        RiskIdentificationSafety: thisuser.RiskIdentificationSafety,
                        ParticipateJSPAnalysts: thisuser.ParticipateJSPAnalysts,
                        //  JobApproverDepartment: thisuser.JobApproverDepartment,
                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 30; i++) {
            var PersonInChargePidA = randomTreeNode(PersonInChargeTree, '0', true);
            var PersonInChargeIdA = randomTreeNode(PersonInChargeTree, PersonInChargePidA);
            $JSPAnalyticalManagement.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                OperatingUnit: randomValue("08"),//作业单位
                ApplicationNumber: Mock.Random.id(),//申请编号
                ApplicationTime: Mock.mock('@date()'),//申请时间
                JobManagere: Mock.Random.cname(),//作业负责人
                Approver: PersonInChargeIdA,//审批人
                //JobApproverDepartment: randomValue("14"),//审批部门
                WorkDescription: Mock.mock('@cparagraph(1, 1)'),//工作描述
                PersonalProtectiveEquipment: Mock.mock('@cparagraph(1, 1)'),//要求和建议的个人防护用品
             //   RiskIdentificationSafety: RiskStepsBasedDatabase(),//风险识别及安全措施
                RiskIdentificationSafety: MaintenanceActivitiesDatabase(),//风险识别及安全措施 (只跳检维修作业活动  作业活动等于作业步骤)

                ParticipateJSPAnalysts: JSPAnalysts(),//分析人
            }));
        }
    }
}

//只跳检维修作业活动  作业活动等于作业步骤
function MaintenanceActivitiesDatabase() {
    var RiskStepsBasedDatabaseList = []
    for (var i = 0; i < 3; i++) {
        var RiskStepsDatabase = {};
        RiskStepsDatabase.RiskStepsName = randomValue("21");
        RiskStepsDatabase.Risk = randomValue("22");
        RiskStepsDatabase.ControlRequirement = randomValue("20");
        RiskStepsDatabase.HazardousFactors = randomValue("19");
        RiskStepsBasedDatabaseList.push(RiskStepsDatabase);
    }
    return RiskStepsBasedDatabaseList;
}



function RiskStepsBasedDatabase() {
    var RiskStepsBasedDatabaseList = [];//最外围数组
    var id = Mock.Random.id();
    for (var i = 0; i < 2; i++) {
        var RiskStepsDatabase = {};//声明一个对象A
        RiskStepsDatabase.RiskStepsName = randomValue("21");
        RiskStepsDatabase.RiskStepsId = id;
        RiskStepsDatabase.RiskTypeId = random(0, 6);
        RiskStepsDatabase.List = [];
        for (var j = 0; j < 2; j++) {
            var listItemObj = {};
            listItemObj.id = Mock.Random.id();
            listItemObj.Pid = id;
            listItemObj.Risk = randomValue("22");
            listItemObj.ControlRequirement = randomValue("20");
            listItemObj.HazardousFactors = randomValue("19");
            listItemObj.ControlDepartment = randomValue("14");
            listItemObj.ControlConfirmor = randomValue("09");
            RiskStepsDatabase.List.push(listItemObj);
        }
        RiskStepsBasedDatabaseList.push(RiskStepsDatabase);
    }
    return RiskStepsBasedDatabaseList;
}




function RiskIdentification() {
    var RiskIdentificationList = [];
    for (var i = 0; i < 3; i++) {
        var Number = random(0, 4);
        var model = {};
        model.WorkProcedure = getDicValue("21", Number);
        model.Risk = getDicValue("22", Number);
        model.ControlRequirements = getDicValue("20", Number);
        RiskIdentificationList.push(model);
    }
    return RiskIdentificationList;
}
function JSPAnalysts() {
    var JSPAnalystsList = [];
    for (var i = 0; i < 3; i++) {
        var Number = random(0, 4);
        var model = {};
        model.Unit = getDicValue("14", Number);
        model.JSPAnalyst = Mock.Random.cname();
        JSPAnalystsList.push(model);
    }
    return JSPAnalystsList;
}



//安全作业方案管理
var $SafeOperationPlan = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/SafeOperationPlan/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $SafeOperationPlan.EquipmenFacilities.length; i++) {
                    temp.push($SafeOperationPlan.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $SafeOperationPlan.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/SafeOperationPlan/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($SafeOperationPlan.EquipmenFacilities.length == 0) {
                        $SafeOperationPlan.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var ApplicationNumber = p.model.ApplicationNumber;
                    var OperatingUnit = p.model.OperatingUnit;
                    var JobManagere = p.model.JobManagere;
                    var OperatingName = p.model.OperatingName;
       
                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $SafeOperationPlan.EquipmenFacilities.length; i++) {
                        var user = $SafeOperationPlan.EquipmenFacilities[i];
                        if (ApplicationNumber && user.ApplicationNumber.indexOf(ApplicationNumber) == -1)
                            continue;
                        if (OperatingUnit && user.OperatingUnit.indexOf(OperatingUnit) == -1)
                            continue;
                        if (JobManagere && user.JobManagere.indexOf(JobManagere) == -1)
                            continue;
                        if (OperatingName && user.OperatingName.indexOf(OperatingName) == -1)
                            continue;
                        user.OperatingUnit = getDicValue("08", user.OperatingUnit) == '' ? user.OperatingUnit : getDicValue("08", user.OperatingUnit);

                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
            ////获取Input数据
            case '/api/SafeOperationPlan/get': Mock.mock(host + url + '?' + param, type, function (options) {
                var myUsers = parent.$SafeOperationPlan.EquipmenFacilities;
                myuser = {};
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        break;
                    }
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            ////提交
            case '/api/SafeOperationPlan/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$SafeOperationPlan.EquipmenFacilities;
                var cz = true;

                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].OperatingUnit = thisuser.OperatingUnit;
                        thisUsers[i].ApplicationNumber = thisuser.ApplicationNumber;
                        thisUsers[i].ApplicationTime = thisuser.ApplicationTime;
                        thisUsers[i].JobManagere = thisuser.JobManagere;
                        thisUsers[i].OperatingName = thisuser.OperatingName;
                        thisUsers[i].JobLocation = thisuser.JobLocation;
                        thisUsers[i].JobStartTime = thisuser.JobStartTime;
                        thisUsers[i].Operators = thisuser.Operators;
                        thisUsers[i].RequiredTools = thisuser.RequiredTools;
                        thisUsers[i].MaterialsNeeded = thisuser.MaterialsNeeded;
                        thisUsers[i].ProtectiveEquipment = thisuser.ProtectiveEquipment;
                        thisUsers[i].LicenseProcessed = thisuser.LicenseProcessed;
                        thisUsers[i].JobTask = thisuser.JobTask;
                        thisUsers[i].JobDeploymentMethod = thisuser.JobDeploymentMethod;
                        thisUsers[i].DrawingsOrCalculations = thisuser.DrawingsOrCalculations;
                        thisUsers[i].OperationProcess = thisuser.OperationProcess;
                        thisUsers[i].RiskIdentificationSafety = thisuser.RiskIdentificationSafety;
                        thisUsers[i].safetyEmergencyTreatmentPlan = thisuser.safetyEmergencyTreatmentPlan;
                        thisUsers[i].Remarks = thisuser.Remarks;
                        thisUsers[i].SigningStaff = thisuser.SigningStaff;
                        thisUsers[i].OperatorSafetyTechnologyConfirmation = thisuser.OperatorSafetyTechnologyConfirmation;
                        thisUsers[i].contractor = thisuser.contractor;
                        thisUsers[i].ApprovedUnit = thisuser.ApprovedUnit;
                        thisUsers[i].ApprovedBy = thisuser.ApprovedBy;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    //Input 页面需要 去操作List页面的数组 parent
                    var PersonInChargePidA = randomTreeNode(PersonInChargeTree, '0', true);
                    var PersonInChargeIdA = randomTreeNode(PersonInChargeTree, PersonInChargePidA);
                    parent.$SafeOperationPlan.EquipmenFacilities.push({
                        id: Mock.Random.id(),
                        OperatingUnit: thisuser.OperatingUnit,
                        ApplicationNumber: thisuser.ApplicationNumber,
                        ApplicationTime: thisuser.ApplicationTime,
                        JobManagere: thisuser.JobManagere,
                        OperatingName: thisuser.OperatingName,
                        JobLocation: thisuser.JobLocation,
                        JobStartTime: thisuser.JobStartTime,
                        Operators: thisuser.Operators,
                        RequiredTools: thisuser.RequiredTools,
                        MaterialsNeeded: thisuser.MaterialsNeeded,
                        ProtectiveEquipment: thisuser.ProtectiveEquipment,
                        LicenseProcessed: thisuser.LicenseProcessed,
                        JobTask: thisuser.JobTask,
                        JobDeploymentMethod: thisuser.JobDeploymentMethod,
                        DrawingsOrCalculations: thisuser.DrawingsOrCalculations,
                        OperationProcess: thisuser.OperationProcess,
                        RiskIdentificationSafety: thisuser.RiskIdentificationSafety,
                        safetyEmergencyTreatmentPlan: thisuser.safetyEmergencyTreatmentPlan,
                        Remarks: thisuser.Remarks,
                        SigningStaff: thisuser.SigningStaff,
                        OperatorSafetyTechnologyConfirmation: thisuser.OperatorSafetyTechnologyConfirmation,
                        ApprovedBy: PersonInChargeIdA,
                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 30; i++) {
            var PersonInChargePidA = randomTreeNode(PersonInChargeTree, '0', true);
            var PersonInChargeIdA = randomTreeNode(PersonInChargeTree, PersonInChargePidA);
            $SafeOperationPlan.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                OperatingUnit: randomValue("08"),//作业单位
                ApplicationNumber: Mock.Random.id(),//申请编号
                ApplicationTime: Mock.mock('@date()'),//申请时间
                OperatingName: Mock.Random.cname(),//"作业名称",
                JobManagere: Mock.Random.cname(),//作业负责人
                JobLocation: randomValue("97"),//作业地点
                JobStartTime: Mock.Random.datetime(),//作业起始时间
                Operators: Mock.Random.cname(),//作业人员
                RequiredTools: Mock.mock('@cparagraph(1, 1)'),//所需工具
                MaterialsNeeded: Mock.mock('@cparagraph(1, 1)'),//所需材料
                ProtectiveEquipment: Mock.mock('@cparagraph(1, 1)'),//防护用品
                LicenseProcessed: randomValue("91", 3),//需办理的许可证
                JobTask: Mock.mock('@cparagraph(1, 1)'),//作业任务
                JobDeploymentMethod: Mock.mock('@cparagraph(1, 1)'),//"二、作业部署方法",
                DrawingsOrCalculations: Mock.mock('@cparagraph(1, 1)'),//"三、图纸或计算",
                OperationProcess: Mock.mock('@cparagraph(1, 1)'),// "四、作业流程",           
                //   RiskIdentificationSafety: RiskStepsBasedDatabase(),//五、安全技术措施"
                RiskIdentificationSafety: MaintenanceActivitiesDatabase(),//五、安全技术措施" (只跳检维修作业活动  作业活动等于作业步骤)

                safetyEmergencyTreatmentPlan: Mock.mock('@cparagraph(1, 1)'),//"六、安全应急处理方案",
                Remarks: Mock.mock('@cparagraph(1, 1)'),//"备注",
                SigningStaff: [{ Unit: randomValue("14"), SigningPeople: Mock.Random.cname() }],//会签
                OperatorSafetyTechnologyConfirmation: randomValue("90", 2),// "作业人员安全技术交底确认",
                contractor: randomValue("12"),//承包商
                ApprovedBy: PersonInChargeIdA,//批准人
            }));
        }
    }
}



//<!--设备设施列表-->
var $EquipmenFacilities = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            //获取List数据
            case '/api/EquipmenFacilities/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($EquipmenFacilities.EquipmenFacilities.length == 0) {
                        $EquipmenFacilities.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var Device = p.model.Device;
                    var FunctionalPart = p.model.FunctionalPart;
                    var Sub_functionPart = p.model.Sub_functionPart;
                    var B_ComponentName = p.model.B_ComponentName;
                    var ExpectedFunction = p.model.ExpectedFunction;
                    var Malfunction = p.model.Malfunction;
                    var Risk = p.model.Risk;
                    var HazardousFactors = p.model.HazardousFactors;
                    var ControlRequirement = p.model.ControlRequirement;
                    var RiskLevel = getDicValue("03", p.model.RiskLevel);
                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $EquipmenFacilities.EquipmenFacilities.length; i++) {
                        var user = $EquipmenFacilities.EquipmenFacilities[i];
                        if (Device && user.Device.indexOf(Device) == -1)
                            continue;
                        if (FunctionalPart && user.FunctionalPart.indexOf(FunctionalPart) == -1)
                            continue;
                        if (Sub_functionPart && user.Sub_functionPart.indexOf(Sub_functionPart) == -1)
                            continue;
                        if (B_ComponentName && user.B_ComponentName.indexOf(B_ComponentName) == -1)
                            continue;
                        if (ExpectedFunction && user.ExpectedFunction.indexOf(ExpectedFunction) == -1)
                            continue;
                        if (Malfunction && user.Malfunction.indexOf(Malfunction) == -1)
                            continue;
                        if (Risk && user.Risk.indexOf(Risk) == -1)
                            continue;
                        if (HazardousFactors && user.HazardousFactors.indexOf(HazardousFactors) == -1)
                            continue;
                        if (ControlRequirement && user.ControlRequirement.indexOf(ControlRequirement) == -1)
                            continue;
                        if (RiskLevel && user.RiskLevel.indexOf(RiskLevel) == -1)
                            continue;
                        user.RiskLevel = getDicValue("03", user.RiskLevel) == '' ? user.RiskLevel : getDicValue("03", user.RiskLevel);
                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 5; i++) {
            $EquipmenFacilities.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                Device: randomValue("23"),
                FunctionalPart: Mock.mock('@cparagraph(1, 1)'),
                Sub_functionPart: Mock.mock('@cparagraph(1, 1)'),
                B_ComponentName: Mock.mock('@cparagraph(1, 1)'),
                ExpectedFunction: Mock.mock('@cparagraph(1,1)'),
                Malfunction: Mock.mock('@cparagraph(1, 1)'),
                Risk: getDicValue("22", i),
                HazardousFactors: randomValue("19"),
                ControlRequirement: getDicValue("20", i),
                RiskLevel: randomValue('03')
            }));

        }
    }
}
//<!--检维修作业活动编辑-->
var $InspectionMaintenanceActivities = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/InspectionMaintenanceActivities/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                //$InspectionMaintenanceActivities.EquipmenFacilities = $InspectionMaintenanceActivities.EquipmenFacilities.filter(function (u) {
                //    return !delIDs.includes(u.id);
                //});

                var temp = [];
                for (var i = 0; i < $InspectionMaintenanceActivities.EquipmenFacilities.length; i++) {
                    temp.push($InspectionMaintenanceActivities.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {

                    if (delIDs.includes(temp[i].id)) {
                        $InspectionMaintenanceActivities.EquipmenFacilities.splice(temp[i], 1);
                    }
                }

                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/InspectionMaintenanceActivities/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($InspectionMaintenanceActivities.EquipmenFacilities.length == 0) {
                        $InspectionMaintenanceActivities.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var JobModule = p.model.JobModule;
                    var MaintanenceProject = p.model.MaintanenceProject;
                    var JobActivity = p.model.JobActivity;

                    var Risk = p.model.Risk;
                    var HazardousFactors = p.model.HazardousFactors;
                    var ControlRequirement = p.model.ControlRequirement;
                    var RiskLevel = getDicValue("03", p.model.RiskLevel);
                    var TreeNode = p.model.TreeNode;

                    //分页
                    var offset = p.offset;
                    var limit = p.limit;

                    var limitUsers2 = [];
                    for (var i = 0; i < $InspectionMaintenanceActivities.EquipmenFacilities.length; i++) {
                        var user = $InspectionMaintenanceActivities.EquipmenFacilities[i];
                        if (JobModule && user.JobModule.indexOf(JobModule) == -1)
                            continue;
                        if (MaintanenceProject && user.MaintanenceProject.indexOf(MaintanenceProject) == -1)
                            continue;
                        if (JobActivity && user.JobActivity.indexOf(JobActivity) == -1)
                            continue;
                        if (Risk && user.Risk.indexOf(Risk) == -1)
                            continue;
                        if (HazardousFactors && user.HazardousFactors.indexOf(HazardousFactors) == -1)
                            continue;
                        if (ControlRequirement && user.ControlRequirement.indexOf(ControlRequirement) == -1)
                            continue;
                        if (RiskLevel && user.RiskLevel.indexOf(RiskLevel) == -1)
                            continue;
                        if (TreeNode && user.TreeNode.indexOf(TreeNode) == -1)
                            continue;
                        user.RiskLevel = getDicValue("03", user.RiskLevel) == '' ? user.RiskLevel : getDicValue("03", user.RiskLevel);

                        limitUsers2.push(user);
                    }
                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
            ////获取Input数据
            case '/api/InspectionMaintenanceActivities/get': Mock.mock(host + url + '?' + param, type, function (options) {

                var myUsers = parent.$InspectionMaintenanceActivities.EquipmenFacilities;
                myuser = {};
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        break;
                    }
                }
                myuser.RiskLevel = getDicKey("03", myuser.RiskLevel);
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            ////提交
            case '/api/InspectionMaintenanceActivities/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$InspectionMaintenanceActivities.EquipmenFacilities;
                var cz = true;

                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].JobModule = thisuser.JobModule;
                        thisUsers[i].MaintanenceProject = thisuser.MaintanenceProject;
                        thisUsers[i].JobActivity = thisuser.JobActivity;
                        thisUsers[i].Risk = thisuser.Risk;
                        thisUsers[i].HazardousFactors = thisuser.HazardousFactors;
                        thisUsers[i].ControlRequirement = thisuser.ControlRequirement;
                        thisUsers[i].RiskLevel = thisuser.RiskLevel;
                        thisUsers[i].TreeNode = thisuser.TreeNode;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    //Input 页面需要 去操作List页面的数组 parent
                    parent.$InspectionMaintenanceActivities.EquipmenFacilities.push({
                        id: Mock.Random.id(),
                        JobModule: thisuser.JobModule,
                        MaintanenceProject: thisuser.MaintanenceProject,
                        JobActivity: thisuser.JobActivity,
                        Risk: thisuser.Risk,
                        HazardousFactors: thisuser.HazardousFactors,
                        ControlRequirement: thisuser.ControlRequirement,
                        RiskLevel: thisuser.RiskLevel,
                        TreeNode: randomTreeNode(myTree),
                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 5; i++) {
            $InspectionMaintenanceActivities.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                JobModule: randomValue('21'),
                MaintanenceProject: Mock.mock('@cparagraph(1, 1)'),
                JobActivity: Mock.mock('@cparagraph(1, 1)'),
                Risk: getDicValue('22', i),
                HazardousFactors: randomValue('19'),
                ControlRequirement: getDicValue('20', i),
                RiskLevel: randomValue('03'),
                TreeNode: randomTreeNode(myTree)
            }));
        }
    }
}
//<!--操作程序列表-->
var $OperatingProcedures = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            case '/api/OperatingProcedures/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($OperatingProcedures.EquipmenFacilities.length == 0) {
                        $OperatingProcedures.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var JobSteps = p.model.JobSteps;
                    var JobTask = p.model.JobTask;
                    var Risk = p.model.Risk;
                    var HazardousFactors = p.model.HazardousFactors;
                    var ControlRequirement = p.model.ControlRequirement;
                    var RiskLevel = getDicValue("03", p.model.RiskLevel);

                    //分页
                    var offset = p.offset;
                    var limit = p.limit;

                    var limitUsers2 = [];
                    for (var i = 0; i < $OperatingProcedures.EquipmenFacilities.length; i++) {
                        var user = $OperatingProcedures.EquipmenFacilities[i];
                        if (JobSteps && user.JobSteps.indexOf(JobSteps) == -1)
                            continue;
                        if (JobTask && user.JobTask.indexOf(JobTask) == -1)
                            continue;
                        if (Risk && user.Risk.indexOf(Risk) == -1)
                            continue;
                        if (HazardousFactors && user.HazardousFactors.indexOf(HazardousFactors) == -1)
                            continue;
                        if (ControlRequirement && user.ControlRequirement.indexOf(ControlRequirement) == -1)
                            continue;
                        if (RiskLevel && user.RiskLevel.indexOf(RiskLevel) == -1)
                            continue;
                        user.RiskLevel = getDicValue("03", user.RiskLevel) == '' ? user.RiskLevel : getDicValue("03", user.RiskLevel);
                        limitUsers2.push(user);
                    }
                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 5; i++) {
            $OperatingProcedures.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                JobSteps: randomValue('21'),
                JobTask: randomValue('24'),
                Risk: getDicValue('22', i),
                HazardousFactors: randomValue('19'),
                ControlRequirement: getDicValue('20', i),
                RiskLevel: randomValue('03')
            }));
        }
    }
}
//< !--操作及相关作业活动列表-->
var $OperationRelatedActivities = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            //获取List数据
            case '/api/OperationRelatedActivities/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($OperationRelatedActivities.EquipmenFacilities.length == 0) {
                        $OperationRelatedActivities.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var JobSteps = p.model.JobSteps;
                    var JobTask = p.model.JobTask;
                    var Risk = p.model.Risk;
                    var HazardousFactors = p.model.HazardousFactors;
                    var ControlRequirement = p.model.ControlRequirement;
                    var RiskLevel = getDicValue("03", p.model.RiskLevel);

                    //分页
                    var offset = p.offset;
                    var limit = p.limit;

                    var limitUsers2 = [];
                    for (var i = 0; i < $OperationRelatedActivities.EquipmenFacilities.length; i++) {
                        var user = $OperationRelatedActivities.EquipmenFacilities[i];
                        if (JobSteps && user.JobSteps.indexOf(JobSteps) == -1)
                            continue;
                        if (JobTask && user.JobTask.indexOf(JobTask) == -1)
                            continue;
                        if (Risk && user.Risk.indexOf(Risk) == -1)
                            continue;
                        if (HazardousFactors && user.HazardousFactors.indexOf(HazardousFactors) == -1)
                            continue;
                        if (ControlRequirement && user.ControlRequirement.indexOf(ControlRequirement) == -1)
                            continue;
                        if (RiskLevel && user.RiskLevel.indexOf(RiskLevel) == -1)
                            continue;
                        user.RiskLevel = getDicValue("03", user.RiskLevel) == '' ? user.RiskLevel : getDicValue("03", user.RiskLevel);
                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 5; i++) {
            $OperationRelatedActivities.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                JobSteps: randomValue('21'),
                JobTask: randomValue('24'),
                Risk: getDicValue('22', i),
                HazardousFactors: randomValue('19'),
                ControlRequirement: getDicValue('20', i),
                RiskLevel: randomValue('03'),
                RequirementsComply: Mock.mock('@cparagraph(1, 1)'),
            }));
        }
    }
}
//< !--场所环境列表-->
var $PlaceEnvironment = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            //获取List数据
            case '/api/PlaceEnvironment/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($PlaceEnvironment.EquipmenFacilities.length == 0) {
                        $PlaceEnvironment.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var PlaceEnvironmentName = p.model.PlaceEnvironmentName;
                    var EnergySource = p.model.EnergySource;
                    var Risk = p.model.Risk;
                    var HazardousFactors = p.model.HazardousFactors;
                    var ControlRequirement = p.model.ControlRequirement;
                    var RiskLevel = getDicValue("03", p.model.RiskLevel);
                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $PlaceEnvironment.EquipmenFacilities.length; i++) {
                        var user = $PlaceEnvironment.EquipmenFacilities[i];
                        if (PlaceEnvironmentName && user.PlaceEnvironmentName.indexOf(PlaceEnvironmentName) == -1)
                            continue;
                        if (EnergySource && user.EnergySource.indexOf(EnergySource) == -1)
                            continue;
                        if (Risk && user.Risk.indexOf(Risk) == -1)
                            continue;
                        if (HazardousFactors && user.HazardousFactors.indexOf(HazardousFactors) == -1)
                            continue;
                        if (ControlRequirement && user.ControlRequirement.indexOf(ControlRequirement) == -1)
                            continue;
                        if (RiskLevel && user.RiskLevel.indexOf(RiskLevel) == -1)
                            continue;
                        user.RiskLevel = getDicValue("03", user.RiskLevel) == '' ? user.RiskLevel : getDicValue("03", user.RiskLevel);

                        limitUsers2.push(user);
                    }
                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 5; i++) {
            $PlaceEnvironment.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                PlaceEnvironmentName: Mock.mock('@cparagraph(1, 1)'),
                EnergySource: Mock.mock('@cparagraph(1, 1)'),
                Risk: getDicValue('22', i),
                HazardousFactors: randomValue('19'),
                ControlRequirement: getDicValue('20', i),
                RiskLevel: randomValue('03')
            }));
        }
    }
}
//<!--工艺介质列表-->
var $ProcessMedium = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {

            //获取List数据
            case '/api/ProcessMedium/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($ProcessMedium.EquipmenFacilities.length == 0) {
                        $ProcessMedium.InitArray();
                    }

                    var p = JSON.parse(options.body);
                    //条件
                    var FeatureCharacteristics = p.model.FeatureCharacteristics;
                    var GuideWord = p.model.GuideWord;
                    var Deviation = p.model.Deviation;
                    var Risk = p.model.Risk;
                    var HazardousFactors = p.model.HazardousFactors;
                    var ControlRequirement = p.model.ControlRequirement;
                    var RiskLevel = getDicValue("03", p.model.RiskLevel);

                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $ProcessMedium.EquipmenFacilities.length; i++) {
                        var user = $ProcessMedium.EquipmenFacilities[i];
                        if (FeatureCharacteristics && user.FeatureCharacteristics.indexOf(FeatureCharacteristics) == -1)
                            continue;
                        if (GuideWord && user.GuideWord.indexOf(GuideWord) == -1)
                            continue;
                        if (Deviation && user.Deviation.indexOf(Deviation) == -1)
                            continue;
                        if (Risk && user.Risk.indexOf(Risk) == -1)
                            continue;
                        if (HazardousFactors && user.HazardousFactors.indexOf(HazardousFactors) == -1)
                            continue;
                        if (ControlRequirement && user.ControlRequirement.indexOf(ControlRequirement) == -1)
                            continue;
                        if (RiskLevel && user.RiskLevel.indexOf(RiskLevel) == -1)
                            continue;
                        user.RiskLevel = getDicValue("03", user.RiskLevel) == '' ? user.RiskLevel : getDicValue("03", user.RiskLevel);
                        limitUsers2.push(user);
                    }


                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }

                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 5; i++) {
            $ProcessMedium.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                FeatureCharacteristics: Mock.mock('@cparagraph(1, 1)'),
                GuideWord: Mock.mock('@cparagraph(1, 1)'),
                Deviation: Mock.mock('@cparagraph(1, 1)'),
                Risk: getDicValue('22', i),
                HazardousFactors: randomValue('19'),
                ControlRequirement: getDicValue('20', i),
                RiskLevel: randomValue('03')
            }));
        }
    }
}
//<!--作业活动列表-->
var $WorkAtivities = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {

            //获取List数据
            case '/api/WorkAtivities/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($WorkAtivities.EquipmenFacilities.length == 0) {
                        $WorkAtivities.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var JobSteps = p.model.JobSteps;
                    var JobTask = p.model.JobTask;
                    var Risk = p.model.Risk;
                    var HazardousFactors = p.model.HazardousFactors;
                    var ControlRequirement = p.model.ControlRequirement;
                    var RiskLevel = getDicValue("03", p.model.RiskLevel);
                    //分页
                    var offset = p.offset;
                    var limit = p.limit;

                    var limitUsers2 = [];
                    for (var i = 0; i < $WorkAtivities.EquipmenFacilities.length; i++) {
                        var user = $WorkAtivities.EquipmenFacilities[i];
                        if (JobSteps && user.JobSteps.indexOf(JobSteps) == -1)
                            continue;
                        if (JobTask && user.JobTask.indexOf(JobTask) == -1)
                            continue;
                        if (Risk && user.Risk.indexOf(Risk) == -1)
                            continue;
                        if (HazardousFactors && user.HazardousFactors.indexOf(HazardousFactors) == -1)
                            continue;
                        if (ControlRequirement && user.ControlRequirement.indexOf(ControlRequirement) == -1)
                            continue;
                        if (RiskLevel && user.RiskLevel.indexOf(RiskLevel) == -1)
                            continue;
                        user.RiskLevel = getDicValue("03", user.RiskLevel) == '' ? user.RiskLevel : getDicValue("03", user.RiskLevel);


                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 5; i++) {
            $WorkAtivities.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                JobSteps: randomValue('21'),
                JobTask: randomValue('24'),
                Risk: getDicValue('22', i),
                HazardousFactors: randomValue('19'),
                ControlRequirement: getDicValue('20', i),
                RiskLevel: randomValue('03')
            }));
        }
    }
}



//一般吊装作业安全许可证管理
var $GeneralLiftingWorkSafety = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/GeneralLiftingWorkSafety/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $GeneralLiftingWorkSafety.EquipmenFacilities.length; i++) {
                    temp.push($GeneralLiftingWorkSafety.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $GeneralLiftingWorkSafety.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/GeneralLiftingWorkSafety/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($GeneralLiftingWorkSafety.EquipmenFacilities.length == 0) {
                        $GeneralLiftingWorkSafety.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var ApplicationNumber = p.model.ApplicationNumber;
                    var OperatingUnit = getDicValue("08", p.model.OperatingUnit);
                    var JobManagere = p.model.JobManagere;
                    var TerritorialDepartment = getDicValue("14", p.model.OperatingName);

                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $GeneralLiftingWorkSafety.EquipmenFacilities.length; i++) {
                        var user = $GeneralLiftingWorkSafety.EquipmenFacilities[i];
                        if (ApplicationNumber && user.ApplicationNumber.indexOf(ApplicationNumber) == -1)
                            continue;
                        if (OperatingUnit && user.OperatingUnit.indexOf(OperatingUnit) == -1)
                            continue;
                        if (JobManagere && user.JobManagere.indexOf(JobManagere) == -1)
                            continue;
                        if (TerritorialDepartment && user.TerritorialDepartment.indexOf(TerritorialDepartment) == -1)
                            continue;
                        user.OperatingUnit = getDicValue("08", user.OperatingUnit) == '' ? user.OperatingUnit : getDicValue("08", user.OperatingUnit);
                        user.TerritorialDepartment = getDicValue("14", user.TerritorialDepartment) == '' ? user.TerritorialDepartment : getDicValue("14", user.TerritorialDepartment);
                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;


            case '/api/GeneralLiftingWorkSafety/RelatedTable': Mock.mock(host + url, type,
                function (options) {
                    if ($GeneralLiftingWorkSafety.RelatedTable.length == 0) {
                        $GeneralLiftingWorkSafety.RelatedTableList();
                    }
                    var list = $GeneralLiftingWorkSafety.RelatedTableList();
                    var myUsers = parent.app.Form.RelatedForm;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    for (var i = 0; i < $GeneralLiftingWorkSafety.RelatedTable.length; i++) {
                        $GeneralLiftingWorkSafety.RelatedTable[i].RelatedFormName = myuser.RelatedFormName;
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var RelatedFormNo = p.model.RelatedFormNo;
                    var RelatedPeople = p.model.RelatedPeople;

                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $GeneralLiftingWorkSafety.RelatedTable.length; i++) {
                        var user = $GeneralLiftingWorkSafety.RelatedTable[i];
                        if (RelatedFormNo && user.RelatedFormNo.indexOf(RelatedFormNo) == -1)
                            continue;
                        if (RelatedPeople && user.RelatedPeople.indexOf(RelatedPeople) == -1)
                            continue;
                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;



            ////获取Input数据
            case '/api/GeneralLiftingWorkSafety/get': Mock.mock(host + url + '?' + param, type, function (options) {

                var myUsers = parent.$GeneralLiftingWorkSafety.EquipmenFacilities;
                myuser = {};
                var bool = true;
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        bool = false
                        break;
                    }
                }
                //新增
                if (bool) {
                    myuser.ApplicationNumber = Mock.Random.id();
                    myuser.HazardIdentification = HazardIdentificationA();
                    myuser.RelatedForm = RelatedFormAdd();//相关表格
                    myuser.Approver = [];//审批人
                    myuser.LiftingOperator = [];
                    myuser.HoistingGuardian = [];
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            case '/api/GeneralLiftingWorkSafety/getRish': Mock.mock(host + url + '?' + param, type, function (options) {
                var id = [];
                $.extend(true, id, parent.app.Form.BasedDatabaseManagementRequirements);
                var myuser = {
                    OperationRelatedActivitiesRish: [], ActivityRish: [], OperatingProcedureRish: [], InspectionMaintenanceActivitiesRish: [],
                    EquipmentFacilitiesRish: [], ProcessMediumRish: [], PlaceEnvironmentRish: []
                };
                for (var i = 0; i < id.length; i++) {
                    if (id[i].RiskTypeId == 0) {
                        myuser.OperationRelatedActivitiesRish.push(id[i]);
                        continue;
                    } else if (id[i].RiskTypeId == 1) {
                        myuser.ActivityRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 2) {
                        myuser.OperatingProcedureRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 3) {
                        myuser.InspectionMaintenanceActivitiesRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 4) {
                        myuser.EquipmentFacilitiesRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 5) {
                        myuser.ProcessMediumRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 6) {
                        myuser.PlaceEnvironmentRish.push(id[i]);
                        continue;
                    }
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            ////提交
            case '/api/GeneralLiftingWorkSafety/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$GeneralLiftingWorkSafety.EquipmenFacilities;
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].OperatingUnit = thisuser.OperatingUnit;
                        thisUsers[i].ApplicationNumber = thisuser.ApplicationNumber;
                        thisUsers[i].ApplicationTime = thisuser.ApplicationTime;
                        thisUsers[i].JobManagere = thisuser.JobManagere;
                        thisUsers[i].OperatingName = thisuser.OperatingName;
                        thisUsers[i].JobLocation = thisuser.JobLocation;
                        thisUsers[i].JobStartTime = thisuser.JobStartTime;
                        thisUsers[i].JobEndTime = thisuser.JobEndTime;
                        thisUsers[i].TerritorialDepartment = thisuser.TerritorialDepartment;
                        thisUsers[i].CurrentJob = thisuser.CurrentJob;
                        thisUsers[i].Level = thisuser.Level;
                        thisUsers[i].HoistingPersonnel = thisuser.HoistingPersonnel;
                        thisUsers[i].HoistingCommander = thisuser.HoistingCommander;
                        thisUsers[i].LiftingContentDescription = thisuser.LiftingContentDescription;
                        thisUsers[i].CraneRatedLoad = thisuser.CraneRatedLoad;
                        thisUsers[i].MaximumWeightObject = thisuser.MaximumWeightObject;
                        thisUsers[i].IsDevelopSafetyPlan = thisuser.IsDevelopSafetyPlan;
                        thisUsers[i].LiftingToolName = thisuser.LiftingToolName;
                        thisUsers[i].InvolvingOtherSpecialOperations = thisuser.InvolvingOtherSpecialOperations;
                        thisUsers[i].contractor = thisuser.contractor;
                        thisUsers[i].HazardIdentification = thisuser.HazardIdentification;
                        thisUsers[i].BasedDatabaseManagementRequirements = thisuser.BasedDatabaseManagementRequirements;
                        thisUsers[i].Approver = thisuser.Approver;
                        thisUsers[i].LiftingOperator = thisuser.LiftingOperator;
                        thisUsers[i].HoistingGuardian = thisuser.HoistingGuardian;
                        thisUsers[i].RelatedForm = thisuser.RelatedForm;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    //Input 页面需要 去操作List页面的数组 parent
                    parent.$GeneralLiftingWorkSafety.EquipmenFacilities.push({
                        id: Mock.Random.id(),
                        OperatingUnit: thisuser.OperatingUnit,
                        ApplicationNumber: thisuser.ApplicationNumber,
                        ApplicationTime: '2018-10-25',
                        JobManagere: thisuser.JobManagere,
                        OperatingName: thisuser.OperatingName,
                        JobLocation: thisuser.JobLocation,
                        JobStartTime: '2018-10-25',
                        JobEndTime: '2018-10-25',
                        TerritorialDepartment: thisuser.TerritorialDepartment,
                        CurrentJob: randomValue("18"),
                        Level: thisuser.Level,
                        HoistingPersonnel: thisuser.HoistingPersonnel,
                        HoistingCommander: thisuser.HoistingCommander,
                        LiftingContentDescription: thisuser.LiftingContentDescription,
                        CraneRatedLoad: thisuser.CraneRatedLoad,
                        MaximumWeightObject: thisuser.MaximumWeightObject,
                        IsDevelopSafetyPlan: thisuser.IsDevelopSafetyPlan,
                        LiftingToolName: thisuser.LiftingToolName,
                        InvolvingOtherSpecialOperations: thisuser.InvolvingOtherSpecialOperations,
                        contractor: thisuser.contractor,
                        HazardIdentification: thisuser.HazardIdentification,
                        BasedDatabaseManagementRequirements: thisuser.BasedDatabaseManagementRequirements,
                        Approver: thisuser.Approver,
                        LiftingOperator: thisuser.LiftingOperator,
                        HoistingGuardian: thisuser.HoistingGuardian,
                        RelatedForm: thisuser.RelatedForm,
                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 30; i++) {
            $GeneralLiftingWorkSafety.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                OperatingUnit: randomValue("08"),//作业单位
                ApplicationNumber: Mock.Random.id(),//申请编号
                ApplicationTime: Mock.mock('@date()'),//申请时间
                OperatingName: Mock.Random.cname(),//"作业名称",
                JobManagere: Mock.Random.cname(),//作业负责人
                JobLocation: randomValue("97"),//作业地点
                JobStartTime: Mock.Random.datetime(),//作业起始时间
                JobEndTime: Mock.Random.datetime(),//有效截至时间
                TerritorialDepartment: randomValue("14"),//属地部门
                CurrentJob: randomValue("18"),//当前作业
                Level: randomValue("03"),//等级
                HoistingPersonnel: Mock.Random.id(),//吊装人员及特殊工种作业证号
                HoistingCommander: Mock.Random.id(),//吊装指挥人及特殊工种作业证号
                LiftingContentDescription: Mock.Random.id(),//吊装内容描述
                CraneRatedLoad: i,//起重机额定载荷
                MaximumWeightObject: i,//被吊物最大重量
                IsDevelopSafetyPlan: randomValue("50"),//是否已制定吊装作业安全方案
                LiftingToolName: Mock.mock('@cparagraph(1, 1)'),//吊装工具名称
                InvolvingOtherSpecialOperations: Mock.mock('@cparagraph(1, 1)'),//涉及其他特殊作业
                contractor: randomValue("12"),//承包商
                HazardIdentification: HazardIdentification(),//危害辨识
                BasedDatabaseManagementRequirements: BasedDatabaseManagementRequirements(),//基于数据库管控要求
                Approver: [{ ApproverUnit: randomValue("08"), ApproverConfirmor: randomValue("09") }],//审批人
                LiftingOperator: [{ LiftingUnit: randomValue("08"), LiftingConfirmor: randomValue("09") }],//吊装作业人
                HoistingGuardian: [{ HoistingUnit: randomValue("08"), HoistingConfirmor: randomValue("09") }],//吊装监护人
                RelatedForm: RelatedForm(),//相关表格

            }));
        }
    },
    RelatedTable: [],
    RelatedTableList: function () {
        for (var i = 0; i < 10; i++) {
            $GeneralLiftingWorkSafety.RelatedTable.push(Mock.mock({
                id: Mock.Random.id(),
                RelatedFormName: '',
                RelatedFormNo: Mock.Random.id(),
                RelatedPeople: Mock.Random.cname(),//申请人
                RelatedTime: Mock.mock('@date()') //时间
            }));
        }
    }
}


function random(lower, upper) {
    return Math.floor(Math.random() * (upper - lower)) + lower;
}

function HazardIdentificationA() {
    var HazardIdentificationList = [];
    for (var i = 0; i < 16; i++) {
        var HazardIdentification = {};
        HazardIdentification.SafetyMeasures = getDicValue("92", i);
        HazardIdentificationList.push(HazardIdentification);
    }
    return HazardIdentificationList;
}
function RelatedFormAdd() {
    var RelatedFormList = [];
    for (var i = 0; i < 3; i++) {
        var RelatedForm = {};
        RelatedForm.id = i;
        RelatedForm.RelatedFormName = getDicValue("93", i);
        RelatedFormList.push(RelatedForm);
    }
    return RelatedFormList;
}

//危害辨识
function HazardIdentification() {
    var HazardIdentificationList = [];
    for (var i = 0; i < 16; i++) {
        var HazardIdentification = {};
        HazardIdentification.SafetyMeasures = getDicValue("92", i);
        HazardIdentification.Department = randomValue("14");
        HazardIdentification.Confirmor = randomValue("09");
        HazardIdentificationList.push(HazardIdentification);
    }
    return HazardIdentificationList;
}

//基于数据库管控要求
function BasedDatabaseManagementRequirements() {
    var BasedDatabaseManagementRequirementsList = [];
    for (var i = 0; i < 3; i++) {
        var BasedDatabaseManagementRequirements = {};
        BasedDatabaseManagementRequirements.RiskTypeId = random(0, 6);
        BasedDatabaseManagementRequirements.Risk = randomValue("22");
        BasedDatabaseManagementRequirements.ControlRequirement = randomValue("20");
        BasedDatabaseManagementRequirements.ControlDepartment = randomValue("14");
        BasedDatabaseManagementRequirements.ControlConfirmor = randomValue("09");
        BasedDatabaseManagementRequirementsList.push(BasedDatabaseManagementRequirements);
    }
    return BasedDatabaseManagementRequirementsList;
}




//相关表格
function RelatedForm() {
    var RelatedFormList = [];
    for (var i = 0; i < 3; i++) {
        var RelatedForm = {};
        RelatedForm.id = i;
        RelatedForm.RelatedFormName = getDicValue("93", i);
        RelatedForm.RelatedFormNo = Mock.Random.id();
        RelatedFormList.push(RelatedForm);
    }
    return RelatedFormList;
}

//钢丝绳和吊钩检查表
var $WireRopeAndHookCheck = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            //删除
            case '/api/WireRopeAndHookCheck/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $WireRopeAndHookCheck.EquipmenFacilities.length; i++) {
                    temp.push($WireRopeAndHookCheck.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $WireRopeAndHookCheck.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/WireRopeAndHookCheck/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($WireRopeAndHookCheck.EquipmenFacilities.length == 0) {
                        $WireRopeAndHookCheck.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var Checker = p.model.Checker;
                    var UseUnit = p.model.UseUnit;

                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $WireRopeAndHookCheck.EquipmenFacilities.length; i++) {
                        var user = $WireRopeAndHookCheck.EquipmenFacilities[i];
                        if (Checker && user.Checker.indexOf(Checker) == -1)
                            continue;
                        if (UseUnit && user.UseUnit.indexOf(UseUnit) == -1)
                            continue;
                        user.Checker = getDicValue("09", user.Checker) == '' ? user.Checker : getDicValue("09", user.Checker);
                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
            ////获取Input数据
            case '/api/WireRopeAndHookCheck/get': Mock.mock(host + url + '?' + param, type, function (options) {

                var myUsers = parent.$WireRopeAndHookCheck.EquipmenFacilities;
                myuser = {};
                var bool = true
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        bool = false;
                        break;
                    }
                }
                if (bool) {
                    myuser.CheckNo = Mock.Random.id();//编号
                    myuser.ForearmWireRope = [{ Measureddiameter: '', Brokenroot: '', DamagedSituation: '' }];//前臂钢丝绳
                    myuser.AuxiliaryArmWireRope = [{ Measureddiameter: '', Brokenroot: '', DamagedSituation: '' }];//前臂钢丝绳
                    myuser.MainArmWireRope = [{ Measureddiameter: '', Brokenroot: '', DamagedSituation: '' }];//主臂钢丝绳
                    myuser.MainHook = [{ MeasuredOpeningSize: '', Diameter: '', IsThereSafetyPin: '', WhetherDeformation: '' }];
                    myuser.AuxiliaryHook = [{ MeasuredOpeningSize: '', Diameter: '', IsThereSafetyPin: '', WhetherDeformation: '' }];
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            ////提交
            case '/api/WireRopeAndHookCheck/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$WireRopeAndHookCheck.EquipmenFacilities;
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].Checker = thisuser.Checker;
                        thisUsers[i].WireRopeStatic = thisuser.WireRopeStatic;
                        thisUsers[i].CheckNo = thisuser.CheckNo;
                        thisUsers[i].CheckDate = thisuser.CheckDate;
                        thisUsers[i].NumberPlate = thisuser.NumberPlate;
                        thisUsers[i].UseUnit = thisuser.UseUnit;
                        thisUsers[i].WorkingArea = thisuser.WorkingArea;
                        thisUsers[i].ForearmWireRope = thisuser.ForearmWireRope;
                        thisUsers[i].AuxiliaryArmWireRope = thisuser.AuxiliaryArmWireRope;
                        thisUsers[i].MainArmWireRope = thisuser.MainArmWireRope;
                        thisUsers[i].MainHook = thisuser.MainHook;
                        thisUsers[i].AuxiliaryHook = thisuser.AuxiliaryHook;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    //Input 页面需要 去操作List页面的数组 parent
                    parent.$WireRopeAndHookCheck.EquipmenFacilities.push({
                        id: Mock.Random.id(),
                        Checker: thisuser.Checker,
                        CheckNo: thisuser.CheckNo,
                        WireRopeStatic: thisuser.WireRopeStatic,
                        CheckDate: thisuser.CheckDate,
                        NumberPlate: thisuser.NumberPlate,
                        UseUnit: thisuser.UseUnit,
                        WorkingArea: thisuser.WorkingArea,
                        ForearmWireRope: thisuser.ForearmWireRope,
                        AuxiliaryArmWireRope: thisuser.AuxiliaryArmWireRope,
                        MainArmWireRope: thisuser.MainArmWireRope,
                        MainHook: thisuser.MainHook,
                        AuxiliaryHook: thisuser.AuxiliaryHook,
                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 80; i++) {
            $WireRopeAndHookCheck.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                Checker: randomValue("09"),//检查人
                WireRopeStatic: randomValue("99"),//检查人
                CheckNo: Mock.Random.id(),//编号
                CheckDate: Mock.Random.datetime(),//时间
                NumberPlate: Mock.Random.id(),//车牌号
                UseUnit: randomValue("08"),//使用单位
                WorkingArea: randomValue("97"),//作业区域
                ForearmWireRope: [{ Measureddiameter: 20, Brokenroot: 10, DamagedSituation: '完好' }],//前臂钢丝绳
                AuxiliaryArmWireRope: [{ Measureddiameter: 15, Brokenroot: 8, DamagedSituation: '完好' }],//副臂钢丝绳
                MainArmWireRope: [{ Measureddiameter: 12, Brokenroot: 9, DamagedSituation: '完好' }],//主臂钢丝绳
                MainHook: [{ MeasuredOpeningSize: 12, Diameter: 9, IsThereSafetyPin: randomValue("50"), WhetherDeformation: randomValue("50") }],// 主钩
                AuxiliaryHook: [{ MeasuredOpeningSize: 10, Diameter: 8, IsThereSafetyPin: randomValue("50"), WhetherDeformation: randomValue("50") }]//辅钩            
            }));
        }
    }
}

//机械移动式起重机外观检查表
var $MechanicalMobileCraneAppearanceCheck = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            //删除
            case '/api/MechanicalMobileCraneAppearanceCheck/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $MechanicalMobileCraneAppearanceCheck.EquipmenFacilities.length; i++) {
                    temp.push($MechanicalMobileCraneAppearanceCheck.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $MechanicalMobileCraneAppearanceCheck.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/MechanicalMobileCraneAppearanceCheck/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($MechanicalMobileCraneAppearanceCheck.EquipmenFacilities.length == 0) {
                        $MechanicalMobileCraneAppearanceCheck.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var Checker = getDicValue("09", p.model.Checker);
                    var WireRopeStatic = getDicValue("99", p.model.WireRopeStatic)
                    var NumberPlate = p.model.NumberPlate;
                    
                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $MechanicalMobileCraneAppearanceCheck.EquipmenFacilities.length; i++) {
                        var user = $MechanicalMobileCraneAppearanceCheck.EquipmenFacilities[i];
                        if (Checker && user.Checker.indexOf(Checker) == -1)
                            continue;
                        if (WireRopeStatic && user.WireRopeStatic.indexOf(WireRopeStatic) == -1)
                            continue;
                        if (NumberPlate && user.NumberPlate.indexOf(NumberPlate) == -1)
                            continue;
                        user.Checker = getDicValue("09", user.Checker) == '' ? user.Checker : getDicValue("09", user.Checker);
                        limitUsers2.push(user);
                    }
                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
            ////获取Input数据
            case '/api/MechanicalMobileCraneAppearanceCheck/get': Mock.mock(host + url + '?' + param, type, function (options) {
                var myUsers = parent.$MechanicalMobileCraneAppearanceCheck.EquipmenFacilities;
                myuser = {};
                var bool = true;
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        bool = false
                        break;
                    }
                }
                //新增
                if (bool) {
                    myuser.CheckNo = Mock.Random.id();//编号
                    myuser.CheckItemListOne = CheckItemListOneAdd();
                    myuser.CheckItemListTwo = CheckItemListTwoAdd();
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            ////提交
            case '/api/MechanicalMobileCraneAppearanceCheck/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$MechanicalMobileCraneAppearanceCheck.EquipmenFacilities;
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].Checker = thisuser.Checker;
                        thisUsers[i].WireRopeStatic = thisuser.WireRopeStatic;
                        thisUsers[i].CheckNo = thisuser.CheckNo;
                        thisUsers[i].CheckDate = thisuser.CheckDate;
                        thisUsers[i].NumberPlate = thisuser.NumberPlate;
                        thisUsers[i].HoistingCommanderNumber = thisuser.HoistingCommanderNumber;
                       
                        thisUsers[i].CheckItemListOne = thisuser.CheckItemListOne;
                        thisUsers[i].CheckItemListTwo = thisuser.CheckItemListTwo;
                        thisUsers[i].InConclusion = thisuser.InConclusion;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    //Input 页面需要 去操作List页面的数组 parent
                    parent.$MechanicalMobileCraneAppearanceCheck.EquipmenFacilities.push({
                        id: Mock.Random.id(),
                        Checker: thisuser.Checker,
                        CheckNo: thisuser.CheckNo,
                        WireRopeStatic: thisuser.WireRopeStatic,
                        CheckDate: thisuser.CheckDate,
                        NumberPlate: thisuser.NumberPlate,
                        HoistingCommanderNumber: thisuser.HoistingCommanderNumber,
                     
                        CheckItemListOne: thisuser.CheckItemListOne,
                        CheckItemListTwo: thisuser.CheckItemListTwo,
                        InConclusion: thisuser.InConclusion,
                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 80; i++) {
            $MechanicalMobileCraneAppearanceCheck.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                Checker: randomValue("09"),//检查人
                WireRopeStatic: randomValue("99"),//检查人
                CheckNo: Mock.Random.id(),//编号
                CheckDate: Mock.Random.datetime(),//时间
                NumberPlate: Mock.Random.id(),//车牌号
                HoistingCommanderNumber: Mock.Random.id(),// "吊装指挥人及特殊工种作业证号"
                CheckItemListOne: CheckItemListOne(),
                CheckItemListTwo: CheckItemListTwo(),
                InConclusion: Mock.mock('@cparagraph(1, 1)')// "结论",

            }));
        }
    }
}
function CheckItemListOne() {
    var CheckItemListOne = [];
    for (var i = 0; i < 12; i++) {
        var CheckItem = {};
        CheckItem.CheckName = getDicValue('140', i);
        CheckItem.checkResult = randomValue("104");
        CheckItem.Problem = Mock.mock('@cparagraph(1, 1)');
        CheckItemListOne.push(CheckItem);
    }
    return CheckItemListOne;
}
function CheckItemListOneAdd() {
    var CheckItemListOne = [];
    for (var i = 0; i < 12; i++) {
        var CheckItem = {};
        CheckItem.CheckName = getDicValue('140', i);
        CheckItem.checkResult = '';
        CheckItem.Problem = '';
        CheckItemListOne.push(CheckItem);
    }
    return CheckItemListOne;
}


function CheckItemListTwo() {
    var CheckItemListOne = [];
    for (var i = 0; i < 17; i++) {
        var CheckItem = {};
        CheckItem.CheckName = getDicValue('141', i);
        CheckItem.checkResult = randomValue("104");
        CheckItem.Problem = Mock.mock('@cparagraph(1, 1)');
        CheckItemListOne.push(CheckItem);
    }
    return CheckItemListOne;
}
function CheckItemListTwoAdd() {
    var CheckItemListOne = [];
    for (var i = 0; i < 17; i++) {
        var CheckItem = {};
        CheckItem.CheckName = getDicValue('141', i);
        CheckItem.checkResult = '';
        CheckItem.Problem = '';
        CheckItemListOne.push(CheckItem);
    }
    return CheckItemListOne;
}





//一般吊装作业方案检查表
var $WorkPlanChecklist = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            //删除
            case '/api/WorkPlanChecklist/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $WorkPlanChecklist.EquipmenFacilities.length; i++) {
                    temp.push($WorkPlanChecklist.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $WorkPlanChecklist.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/WorkPlanChecklist/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($WorkPlanChecklist.EquipmenFacilities.length == 0) {
                        $WorkPlanChecklist.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var Checker = p.model.Checker;
                    var NumberPlate = p.model.NumberPlate;
                    var WireRopeStatic = getDicValue("99", p.model.WireRopeStatic);
                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $WorkPlanChecklist.EquipmenFacilities.length; i++) {
                        var user = $WorkPlanChecklist.EquipmenFacilities[i];
                        if (Checker && user.Checker.indexOf(Checker) == -1)
                            continue;
                        if (NumberPlate && user.NumberPlate.indexOf(NumberPlate) == -1)
                            continue;
                        if (WireRopeStatic && user.WireRopeStatic.indexOf(WireRopeStatic) == -1)
                            continue;
                        user.Checker = getDicValue("09", user.Checker) == '' ? user.Checker : getDicValue("09", user.Checker);
                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
            ////获取Input数据
            case '/api/WorkPlanChecklist/get': Mock.mock(host + url + '?' + param, type, function (options) {

                var myUsers = parent.$WorkPlanChecklist.EquipmenFacilities;
                myuser = {};
                var bool = true
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        bool = false
                        break;
                    }
                }
                if (bool) {
                    myuser.CheckNo = Mock.Random.id();//编号
                    myuser.MainCrane = [{ Before: '', Side: '', Rear: '' }];
                    myuser.AuxiliaryCrane = [{ Before: '', Side: '', Rear: '' }];
                    myuser.SwingMainCrane = [{ Before: '', Side: '', Rear: '' }];
                    myuser.SwingAuxiliaryCrane = [{ Before: '', Side: '', Rear: '' }];
                }

                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            ////提交
            case '/api/WorkPlanChecklist/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$WorkPlanChecklist.EquipmenFacilities;
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].Checker = thisuser.Checker;
                        thisUsers[i].WireRopeStatic = thisuser.WireRopeStatic;
                        thisUsers[i].CheckNo = thisuser.CheckNo;
                        thisUsers[i].BeginTime = thisuser.BeginTime;
                        thisUsers[i].EndTime = thisuser.EndTime;
                        thisUsers[i].NumberPlate = thisuser.NumberPlate;
                        thisUsers[i].UseUnit = thisuser.UseUnit;
                        thisUsers[i].WorkingArea = thisuser.WorkingArea;
                        thisUsers[i].WorkDescription = thisuser.WorkDescription;
                        thisUsers[i].NetWeightOfBeingLifted = thisuser.NetWeightOfBeingLifted;
                        thisUsers[i].UnestimatedMaterialQuality = thisuser.UnestimatedMaterialQuality;
                        thisUsers[i].ResidualLiquidQuality = thisuser.ResidualLiquidQuality;
                        thisUsers[i].Other = thisuser.Other;
                        thisUsers[i].TotalMassObjectBeingLifted = thisuser.TotalMassObjectBeingLifted;
                        thisUsers[i].RatedLiftingMass = thisuser.RatedLiftingMass;
                        thisUsers[i].LengthTheBoom = thisuser.LengthTheBoom;
                        thisUsers[i].AngleTtheBoom = thisuser.AngleTtheBoom;
                        thisUsers[i].WorkingRadius = thisuser.WorkingRadius;
                        thisUsers[i].HangingSize = thisuser.HangingSize;
                        thisUsers[i].LiftingBindingPoint = thisuser.LiftingBindingPoint;
                        thisUsers[i].WalkieTalkie = thisuser.WalkieTalkie;
                        thisUsers[i].MainCrane = thisuser.MainCrane;
                        thisUsers[i].AuxiliaryCrane = thisuser.AuxiliaryCrane;
                        thisUsers[i].SwingAuxiliaryCrane = thisuser.SwingAuxiliaryCrane;
                        thisUsers[i].IsDoesCraneNeedPad = thisuser.IsDoesCraneNeedPad;
                        thisUsers[i].IsElectricalHazardInThisArea = thisuser.IsElectricalHazardInThisArea;
                        thisUsers[i].IsThereAnObstacle = thisuser.IsThereAnObstacle;
                        thisUsers[i].LiftingOperationPersonCharge = thisuser.LiftingOperationPersonCharge;
                        thisUsers[i].HoistingEquipmentTechnician = thisuser.HoistingEquipmentTechnician;
                        thisUsers[i].LiftingDriver = thisuser.LiftingDriver;
                        thisUsers[i].AuthorizedApprover = thisuser.AuthorizedApprover;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    //Input 页面需要 去操作List页面的数组 parent
                    parent.$WorkPlanChecklist.EquipmenFacilities.push({
                        id: Mock.Random.id(),
                        Checker: thisuser.Checker,
                        CheckNo: thisuser.CheckNo,
                        WireRopeStatic: thisuser.WireRopeStatic,
                        BeginTime: thisuser.BeginTime,
                        EndTime: thisuser.EndTime,
                        NumberPlate: thisuser.NumberPlate,
                        UseUnit: thisuser.UseUnit,
                        WorkingArea: thisuser.WorkingArea,
                        WorkDescription: thisuser.WorkDescription,
                        NetWeightOfBeingLifted: thisuser.NetWeightOfBeingLifted,
                        UnestimatedMaterialQuality: thisuser.UnestimatedMaterialQuality,
                        ResidualLiquidQuality: thisuser.ResidualLiquidQuality,
                        Other: thisuser.Other,
                        TotalMassObjectBeingLifted: thisuser.TotalMassObjectBeingLifted,
                        RatedLiftingMass: thisuser.RatedLiftingMass,
                        LengthTheBoom: thisuser.LengthTheBoom,
                        AngleTtheBoom: thisuser.AngleTtheBoom,
                        WorkingRadius: thisuser.WorkingRadius,
                        HangingSize: thisuser.HangingSize,
                        LiftingBindingPoint: thisuser.LiftingBindingPoint,
                        WalkieTalkie: thisuser.WalkieTalkie,
                        MainCrane: thisuser.MainCrane,
                        AuxiliaryCrane: thisuser.AuxiliaryCrane,
                        SwingAuxiliaryCrane: thisuser.SwingAuxiliaryCrane,
                        IsDoesCraneNeedPad: thisuser.IsDoesCraneNeedPad,
                        IsElectricalHazardInThisArea: thisuser.IsElectricalHazardInThisArea,
                        IsThereAnObstacle: thisuser.IsThereAnObstacle,
                        LiftingOperationPersonCharge: thisuser.LiftingOperationPersonCharge,
                        HoistingEquipmentTechnician: thisuser.HoistingEquipmentTechnician,
                        LiftingDriver: thisuser.LiftingDriver,
                        AuthorizedApprover: thisuser.AuthorizedApprover,
                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 15; i++) {
            $WorkPlanChecklist.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                Checker: randomValue("09"),//检查人
                WireRopeStatic: randomValue("99"),//检查人
                CheckNo: Mock.Random.id(),//编号
                BeginTime: Mock.Random.datetime(),//开始时间
                EndTime: Mock.Random.datetime(),//结束时间
                NumberPlate: Mock.Random.id(),//车牌号
                UseUnit: randomValue("08"),//使用单位
                WorkingArea: randomValue("97"),//作业区域
                WorkDescription: Mock.mock('@cparagraph(1, 1)'),//工作描述
                NetWeightOfBeingLifted: i,// "被吊物件净重/空重（A1）",
                UnestimatedMaterialQuality: Mock.mock('@cparagraph(1, 1)'),//"未估算到的材料质量（A2）",
                ResidualLiquidQuality: Mock.mock('@cparagraph(1, 1)'),//"盛装或残留液体质量（A3）",
                Other: Mock.mock('@cparagraph(1, 1)'),//"其他（A4）",
                TotalMassObjectBeingLifted: Mock.mock('@cparagraph(1, 1)'),// "被吊物件总质量（A5）",
                RatedLiftingMass: Mock.mock('@cparagraph(1, 1)'),// "额定起重质量",
                LengthTheBoom: i,// "起重臂的长度",
                AngleTtheBoom: i,// "起重臂的角度",
                WorkingRadius: i,// "工作半径",
                HangingSize: Mock.mock('@cparagraph(1, 1)'),//"被吊物尺寸",
                LiftingBindingPoint: Mock.mock('@cparagraph(1, 1)'),// "吊装的绑缚点",
                WalkieTalkie: randomValue("50"),// "对讲机(单独频率)",
                MainCrane: [{ Before: Mock.mock('@cparagraph(1, 1)'), Side: Mock.mock('@cparagraph(1, 1)'), Rear: Mock.mock('@cparagraph(1, 1)') }],//"主起重机",
                AuxiliaryCrane: [{ Before: Mock.mock('@cparagraph(1, 1)'), Side: Mock.mock('@cparagraph(1, 1)'), Rear: Mock.mock('@cparagraph(1, 1)') }],// "辅助起重机",
                SwingMainCrane: [{ Before: Mock.mock('@cparagraph(1, 1)'), Side: Mock.mock('@cparagraph(1, 1)'), Rear: Mock.mock('@cparagraph(1, 1)') }],// "主起重机",
                SwingAuxiliaryCrane: [{ Before: Mock.mock('@cparagraph(1, 1)'), Side: Mock.mock('@cparagraph(1, 1)'), Rear: Mock.mock('@cparagraph(1, 1)') }],// "辅助起重机",
                IsDoesCraneNeedPad: randomValue("50"),//"起重机是否需要垫板",
                IsElectricalHazardInThisArea: randomValue("50"),//"这个区域是否有电气危险",
                IsThereAnObstacle: randomValue("50"),//"是否有障碍物",
                LiftingOperationPersonCharge: randomValue("09"),//"吊装作业负责人",
                HoistingEquipmentTechnician: randomValue("09"),//"吊装设备技术人员",
                LiftingDriver: randomValue("09"),//"起重司机",
                AuthorizedApprover: randomValue("09"),//"批准人或授权批准人",
            }));
        }
    }
}

//简易吊装作业安全许可证管理
var $SimpleLiftingOperation = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/SimpleLiftingOperation/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $SimpleLiftingOperation.EquipmenFacilities.length; i++) {
                    temp.push($SimpleLiftingOperation.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $SimpleLiftingOperation.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/SimpleLiftingOperation/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($SimpleLiftingOperation.EquipmenFacilities.length == 0) {
                        $SimpleLiftingOperation.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var ApplicationNumber = p.model.ApplicationNumber;
                    var OperatingUnit = getDicValue("08", p.model.OperatingUnit);
                    var JobManagere = p.model.JobManagere;
                    var TerritorialDepartment = getDicValue("14", p.model.TerritorialDepartment);
                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $SimpleLiftingOperation.EquipmenFacilities.length; i++) {
                        var user = $SimpleLiftingOperation.EquipmenFacilities[i];
                        if (ApplicationNumber && user.ApplicationNumber.indexOf(ApplicationNumber) == -1)
                            continue;
                        if (OperatingUnit && user.OperatingUnit.indexOf(OperatingUnit) == -1)
                            continue;
                        if (JobManagere && user.JobManagere.indexOf(JobManagere) == -1)
                            continue;
                        if (TerritorialDepartment && user.TerritorialDepartment.indexOf(TerritorialDepartment) == -1)
                            continue;
                        user.OperatingUnit = getDicValue("08", user.OperatingUnit) == '' ? user.OperatingUnit : getDicValue("08", user.OperatingUnit);
                        user.TerritorialDepartment = getDicValue("14", user.TerritorialDepartment) == '' ? user.TerritorialDepartment : getDicValue("14", user.TerritorialDepartment);
                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
            //获取Input数据
            case '/api/SimpleLiftingOperation/get': Mock.mock(host + url + '?' + param, type, function (options) {

                var myUsers = parent.$SimpleLiftingOperation.EquipmenFacilities;
                myuser = {};
                var bool = true;
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        bool = false
                        break;
                    }
                }
                //新增
                if (bool) {
                    myuser.ApplicationNumber = Mock.Random.id();
                    myuser.HazardIdentification = HazardIdentificationA();
                    myuser.Approver = [];//审批人
                    myuser.LiftingOperator = [];
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            case '/api/SimpleLiftingOperation/getRish': Mock.mock(host + url + '?' + param, type, function (options) {
                var id = parent.app.Form.BasedDatabaseManagementRequirements;
                var myuser = {
                    OperationRelatedActivitiesRish: [], ActivityRish: [], OperatingProcedureRish: [], InspectionMaintenanceActivitiesRish: [],
                    EquipmentFacilitiesRish: [], ProcessMediumRish: [], PlaceEnvironmentRish: []
                };
                for (var i = 0; i < id.length; i++) {
                    if (id[i].RiskTypeId == 0) {
                        myuser.OperationRelatedActivitiesRish.push(id[i]);
                        continue;
                    } else if (id[i].RiskTypeId == 1) {
                        myuser.ActivityRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 2) {
                        myuser.OperatingProcedureRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 3) {
                        myuser.InspectionMaintenanceActivitiesRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 4) {
                        myuser.EquipmentFacilitiesRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 5) {
                        myuser.ProcessMediumRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 6) {
                        myuser.PlaceEnvironmentRish.push(id[i]);
                        continue;
                    }
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            ////提交
            case '/api/SimpleLiftingOperation/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$SimpleLiftingOperation.EquipmenFacilities;
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].OperatingUnit = thisuser.OperatingUnit;
                        thisUsers[i].ApplicationNumber = thisuser.ApplicationNumber;
                        thisUsers[i].ApplicationTime = thisuser.ApplicationTime;
                        thisUsers[i].JobManagere = thisuser.JobManagere;
                        thisUsers[i].OperatingName = thisuser.OperatingName;
                        thisUsers[i].JobLocation = thisuser.JobLocation;
                        thisUsers[i].JobStartTime = thisuser.JobStartTime;
                        thisUsers[i].JobEndTime = thisuser.JobEndTime;
                        thisUsers[i].TerritorialDepartment = thisuser.TerritorialDepartment;
                        thisUsers[i].CurrentJob = thisuser.CurrentJob;
                        thisUsers[i].LiftingContentDescription = thisuser.LiftingContentDescription;
                        thisUsers[i].IsPre_workSafetyAnalysis = thisuser.IsPre_workSafetyAnalysis;
                        thisUsers[i].CraneRatedLoad = thisuser.CraneRatedLoad;
                        thisUsers[i].MaximumWeightObject = thisuser.MaximumWeightObject;
                        thisUsers[i].contractor = thisuser.contractor;
                        thisUsers[i].HazardIdentification = thisuser.HazardIdentification;
                        thisUsers[i].BasedDatabaseManagementRequirements = thisuser.BasedDatabaseManagementRequirements;
                        thisUsers[i].Approver = thisuser.Approver;
                        thisUsers[i].LiftingOperator = thisuser.LiftingOperator;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    //Input 页面需要 去操作List页面的数组 parent
                    parent.$SimpleLiftingOperation.EquipmenFacilities.push({
                        id: Mock.Random.id(),
                        OperatingUnit: thisuser.OperatingUnit,
                        ApplicationNumber: thisuser.ApplicationNumber,
                        ApplicationTime: thisuser.ApplicationTime,
                        JobManagere: thisuser.JobManagere,
                        OperatingName: thisuser.OperatingName,
                        JobLocation: thisuser.JobLocation,
                        JobStartTime: thisuser.JobStartTime,
                        JobEndTime: thisuser.JobEndTime,
                        TerritorialDepartment: thisuser.TerritorialDepartment,
                        CurrentJob: randomValue("18"),
                        LiftingContentDescription: thisuser.LiftingContentDescription,
                        CraneRatedLoad: thisuser.CraneRatedLoad,
                        MaximumWeightObject: thisuser.MaximumWeightObject,
                        IsPre_workSafetyAnalysis: thisuser.IsPre_workSafetyAnalysis,
                        LiftingToolName: thisuser.LiftingToolName,
                        contractor: thisuser.contractor,
                        HazardIdentification: thisuser.HazardIdentification,
                        BasedDatabaseManagementRequirements: thisuser.BasedDatabaseManagementRequirements,
                        Approver: thisuser.Approver,
                        LiftingOperator: thisuser.LiftingOperator,
                        HoistingGuardian: thisuser.HoistingGuardian,
                        RelatedForm: thisuser.RelatedForm,
                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 30; i++) {
            $SimpleLiftingOperation.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                OperatingUnit: randomValue("08"),//作业单位
                ApplicationNumber: Mock.Random.id(),//申请编号
                ApplicationTime: Mock.mock('@date()'),//申请时间
                OperatingName: Mock.Random.cname(),//"作业名称",
                JobManagere: Mock.Random.cname(),//作业负责人
                JobLocation: randomValue("97"),//作业地点
                JobStartTime: Mock.Random.datetime(),//作业起始时间
                JobEndTime: Mock.Random.datetime(),//有效截至时间
                TerritorialDepartment: randomValue("14"),//属地部门
                CurrentJob: randomValue("18"),//当前作业
                LiftingContentDescription: Mock.mock('@natural()'),//吊装内容描述
                CraneRatedLoad: i,//起重机额定载荷
                MaximumWeightObject: i,//被吊物最大重量
                IsPre_workSafetyAnalysis: randomValue("50"),//是否已制定吊装作业安全方案
                contractor: randomValue("12"),//承包商
                HazardIdentification: HazardIdentification(),//危害辨识
                BasedDatabaseManagementRequirements: BasedDatabaseManagementRequirements(),//基于数据库管控要求
                Approver: [{ ApproverUnit: randomValue("08"), ApproverConfirmor: randomValue("09") }],//审批人
                LiftingOperator: [{ LiftingUnit: randomValue("08"), LiftingConfirmor: randomValue("09") }],//吊装作业人
            }));
        }
    }
}


//动火作业安全许可证管理
var $HotWorkSafetyLicense = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/HotWorkSafetyLicense/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $HotWorkSafetyLicense.EquipmenFacilities.length; i++) {
                    temp.push($HotWorkSafetyLicense.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $HotWorkSafetyLicense.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/HotWorkSafetyLicense/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($HotWorkSafetyLicense.EquipmenFacilities.length == 0) {
                        $HotWorkSafetyLicense.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var ApplicationNumber = p.model.ApplicationNumber;
                    var OperatingUnit = getDicValue("08", p.model.OperatingUnit);
                    var JobManagere = p.model.JobManagere;
                    var TerritorialDepartment = getDicValue("14", p.model.OperatingName);
                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $HotWorkSafetyLicense.EquipmenFacilities.length; i++) {
                        var user = $HotWorkSafetyLicense.EquipmenFacilities[i];
                        if (ApplicationNumber && user.ApplicationNumber.indexOf(ApplicationNumber) == -1)
                            continue;
                        if (OperatingUnit && user.OperatingUnit.indexOf(OperatingUnit) == -1)
                            continue;
                        if (JobManagere && user.JobManagere.indexOf(JobManagere) == -1)
                            continue;
                        if (TerritorialDepartment && user.TerritorialDepartment.indexOf(TerritorialDepartment) == -1)
                            continue;
                        user.OperatingUnit = getDicValue("08", user.OperatingUnit) == '' ? user.OperatingUnit : getDicValue("08", user.OperatingUnit);
                        user.TerritorialDepartment = getDicValue("14", user.TerritorialDepartment) == '' ? user.TerritorialDepartment : getDicValue("14", user.TerritorialDepartment);

                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
            //获取Input数据
            case '/api/HotWorkSafetyLicense/get': Mock.mock(host + url + '?' + param, type, function (options) {

                var myUsers = parent.$HotWorkSafetyLicense.EquipmenFacilities;
                myuser = {};
                var bool = true;
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        bool = false
                        break;
                    }
                }
                //新增
                if (bool) {
                    myuser.ApplicationNumber = Mock.Random.id();
                    myuser.HazardIdentification = HazardIdentificationA();
                    myuser.Approver = [];//审批人
                    myuser.AffectedParties = [];//受影响相关方
                    myuser.HotFire = [];//动火人
                    myuser.Fireman = [];//监火人
                    myuser.HSEDepartment = [];//HSE部
                    myuser.Production = [];//"生产部
                    myuser.In_ClassSquadLeader = [];//"当班班长
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            case '/api/HotWorkSafetyLicense/getRish': Mock.mock(host + url + '?' + param, type, function (options) {
                var id = parent.app.Form.BasedDatabaseManagementRequirements;
                var myuser = {
                    OperationRelatedActivitiesRish: [], ActivityRish: [], OperatingProcedureRish: [], InspectionMaintenanceActivitiesRish: [],
                    EquipmentFacilitiesRish: [], ProcessMediumRish: [], PlaceEnvironmentRish: []
                };
                for (var i = 0; i < id.length; i++) {
                    if (id[i].RiskTypeId == 0) {
                        myuser.OperationRelatedActivitiesRish.push(id[i]);
                        continue;
                    } else if (id[i].RiskTypeId == 1) {
                        myuser.ActivityRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 2) {
                        myuser.OperatingProcedureRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 3) {
                        myuser.InspectionMaintenanceActivitiesRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 4) {
                        myuser.EquipmentFacilitiesRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 5) {
                        myuser.ProcessMediumRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 6) {
                        myuser.PlaceEnvironmentRish.push(id[i]);
                        continue;
                    }
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            ////提交
            case '/api/HotWorkSafetyLicense/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$HotWorkSafetyLicense.EquipmenFacilities;
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].OperatingUnit = thisuser.OperatingUnit;
                        thisUsers[i].ApplicationNumber = thisuser.ApplicationNumber;
                        thisUsers[i].ApplicationTime = thisuser.ApplicationTime;
                        thisUsers[i].Level = thisuser.Level;
                        thisUsers[i].JobManagere = thisuser.JobManagere;
                        thisUsers[i].OperatingName = thisuser.OperatingName;
                        thisUsers[i].JobLocation = thisuser.JobLocation;
                        thisUsers[i].JobStartTime = thisuser.JobStartTime;
                        thisUsers[i].JobEndTime = thisuser.JobEndTime;
                        thisUsers[i].TerritorialDepartment = thisuser.TerritorialDepartment;
                        thisUsers[i].CurrentJob = thisuser.CurrentJob;
                        thisUsers[i].HotArea = thisuser.HotArea;
                        thisUsers[i].HotFirePosition = thisuser.HotFirePosition;
                        thisUsers[i].HotContentFescription = thisuser.HotContentFescription;
                        thisUsers[i].IsSafeWorkProgram = thisuser.IsSafeWorkProgram;
                        thisUsers[i].IsDrawing = thisuser.IsDrawing;
                        thisUsers[i].contractor = thisuser.contractor;
                        thisUsers[i].GasDetector = thisuser.GasDetector;
                        thisUsers[i].TestingRequirements = thisuser.TestingRequirements;
                        thisUsers[i].JobType = thisuser.JobType;
                        thisUsers[i].Hazard = thisuser.Hazard;
                        thisUsers[i].HazardIdentification = thisuser.HazardIdentification;
                        thisUsers[i].BasedDatabaseManagementRequirements = thisuser.BasedDatabaseManagementRequirements;
                        thisUsers[i].Approver = thisuser.Approver;
                        thisUsers[i].AffectedParties = thisuser.AffectedParties;
                        thisUsers[i].HotFire = thisuser.HotFire;
                        thisUsers[i].Fireman = thisuser.Fireman;
                        thisUsers[i].HSEDepartment = thisuser.HSEDepartment;
                        thisUsers[i].Production = thisuser.Production;
                        thisUsers[i].In_ClassSquadLeader = thisuser.In_ClassSquadLeader;
                        thisUsers[i].OtherSpecialOperationsInvolved = thisuser.OtherSpecialOperationsInvolved;
                        thisUsers[i].SafetyEducator = thisuser.SafetyEducator;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    //Input 页面需要 去操作List页面的数组 parent
                    parent.$HotWorkSafetyLicense.EquipmenFacilities.push({
                        id: Mock.Random.id(),
                        OperatingUnit: thisuser.OperatingUnit,
                        ApplicationNumber: thisuser.ApplicationNumber,
                        ApplicationTime: '2019-08-20',
                        JobManagere: thisuser.JobManagere,
                        OperatingName: thisuser.OperatingName,
                        JobLocation: thisuser.JobLocation,
                        JobStartTime: '2019-08-20',
                        JobEndTime: '2019-08-20',
                        Level: thisuser.Level,
                        TerritorialDepartment: thisuser.TerritorialDepartment,
                        CurrentJob: randomValue("18"),
                        HotArea: thisuser.HotArea,
                        HotFirePosition: thisuser.HotFirePosition,
                        HotContentFescription: thisuser.HotContentFescription,
                        IsSafeWorkProgram: thisuser.IsSafeWorkProgram,
                        IsDrawing: thisuser.IsDrawing,
                        contractor: thisuser.contractor,
                        GasDetector: thisuser.GasDetector,
                        TestingRequirements: thisuser.TestingRequirements,
                        JobType: thisuser.JobType,
                        Hazard: thisuser.Hazard,
                        HazardIdentification: thisuser.HazardIdentification,
                        BasedDatabaseManagementRequirements: thisuser.BasedDatabaseManagementRequirements,
                        Approver: thisuser.Approver,
                        AffectedParties: thisuser.AffectedParties,
                        HotFire: thisuser.HotFire,
                        Fireman: thisuser.Fireman,
                        HSEDepartment: thisuser.HSEDepartment,
                        Production: thisuser.Production,
                        In_ClassSquadLeader: thisuser.In_ClassSquadLeader,
                        OtherSpecialOperationsInvolved: thisuser.OtherSpecialOperationsInvolved,
                        SafetyEducator: thisuser.SafetyEducator,
                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 30; i++) {
            $HotWorkSafetyLicense.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                OperatingUnit: randomValue("08"),//作业单位
                ApplicationNumber: Mock.Random.id(),//申请编号
                ApplicationTime: Mock.mock('@date()'),//申请时间
                OperatingName: Mock.Random.cname(),//"作业名称",
                JobManagere: Mock.Random.cname(),//作业负责人
                JobLocation: randomValue("97"),//作业地点
                JobStartTime: Mock.Random.datetime(),//作业起始时间
                JobEndTime: Mock.Random.datetime(),//有效截至时间
                TerritorialDepartment: randomValue("14"),//属地部门
                CurrentJob: randomValue("18"),//当前作业
                Level: randomValue("03"),//等级
                HotArea: randomValue("97"),//动火区域
                HotFirePosition: randomValue("n112"),//动火位置
                HotContentFescription: Mock.mock('@natural()'),//吊装内容描述
                IsSafeWorkProgram: randomValue("50"),//是否附安全工作方案
                IsDrawing: randomValue("50"),//是否附图纸
                contractor: randomValue("12"),//承包商
                GasDetector: randomValue("09"),//气体检测人
                TestingRequirements: randomValue("120"),//检测要求(检测频次)
                JobType: randomValue("121", 3),//作业类型
                Hazard: randomValue("122", 3),//危害辨识
                OtherSpecialOperationsInvolved: Mock.mock('@cparagraph(1, 1)'),// "涉及的其他特殊作业",
                SafetyEducator: randomValue("09"),//"安全教育人",
                HazardIdentification: HazardIdentification(),//危害辨识
                BasedDatabaseManagementRequirements: BasedDatabaseManagementRequirements(),//基于数据库管控要求
                Approver: [{ ApproverUnit: randomValue("08"), ApproverConfirmor: randomValue("09") }],//审批人
                AffectedParties: [{ AffectedPartiesUnit: randomValue("08"), AffectedPartiesConfirmor: randomValue("09") }],//受影响相关方
                HotFire: [{ HotFireUnit: randomValue("08"), HotFireConfirmor: randomValue("09") }],//动火人
                Fireman: [{ FiremanUnit: randomValue("08"), FiremanConfirmor: randomValue("09") }],//监火人
                HSEDepartment: [{ HSEUnit: randomValue("08"), HSEConfirmor: randomValue("09") }],//HSE部
                Production: [{ ProductionUnit: randomValue("08"), ProductionConfirmor: randomValue("09") }],//"生产部
                In_ClassSquadLeader: [{ In_ClassUnit: randomValue("08"), In_ClassConfirmor: randomValue("09") }],//"当班班长
            }));
        }
    }
}


//动土作业安全许可证管理
var $EarthmovingWorkSafetyPermit = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            //删除
            case '/api/EarthmovingWorkSafetyPermit/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $EarthmovingWorkSafetyPermit.EquipmenFacilities.length; i++) {
                    temp.push($EarthmovingWorkSafetyPermit.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $EarthmovingWorkSafetyPermit.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/EarthmovingWorkSafetyPermit/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($EarthmovingWorkSafetyPermit.EquipmenFacilities.length == 0) {
                        $EarthmovingWorkSafetyPermit.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var ApplicationNumber = p.model.ApplicationNumber;
                    var OperatingUnit = getDicValue("08", p.model.OperatingUnit);
                    var JobManagere = p.model.JobManagere;
                    var TerritorialDepartment = getDicValue("14", p.model.OperatingName);
                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $EarthmovingWorkSafetyPermit.EquipmenFacilities.length; i++) {
                        var user = $EarthmovingWorkSafetyPermit.EquipmenFacilities[i];
                        if (ApplicationNumber && user.ApplicationNumber.indexOf(ApplicationNumber) == -1)
                            continue;
                        if (OperatingUnit && user.OperatingUnit.indexOf(OperatingUnit) == -1)
                            continue;
                        if (JobManagere && user.JobManagere.indexOf(JobManagere) == -1)
                            continue;
                        if (TerritorialDepartment && user.TerritorialDepartment.indexOf(TerritorialDepartment) == -1)
                            continue;
                        user.OperatingUnit = getDicValue("08", user.OperatingUnit) == '' ? user.OperatingUnit : getDicValue("08", user.OperatingUnit);
                        user.TerritorialDepartment = getDicValue("14", user.TerritorialDepartment) == '' ? user.TerritorialDepartment : getDicValue("14", user.TerritorialDepartment);

                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
            //获取Input数据
            case '/api/EarthmovingWorkSafetyPermit/get': Mock.mock(host + url + '?' + param, type, function (options) {

                var myUsers = parent.$EarthmovingWorkSafetyPermit.EquipmenFacilities;
                myuser = {};
                var bool = true;
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        bool = false
                        break;
                    }
                }
                //新增
                if (bool) {
                    myuser.ApplicationNumber = Mock.Random.id();
                    myuser.HazardIdentification = HazardIdentificationA();
                    myuser.ConcealedFacilities =
                        [{ name: "公用设施线路", IstrueOrFalse: '', PipeDiameterStrike: '', ConcealedFacilities: '', IsolationValve: '' },
                        { name: "循环水管道", IstrueOrFalse: '', PipeDiameterStrike: '', ConcealedFacilities: '', IsolationValve: '' },
                        { name: "自来水管道", IstrueOrFalse: '', PipeDiameterStrike: '', ConcealedFacilities: '', IsolationValve: '' },
                        { name: "污水沟或管道", IstrueOrFalse: '', PipeDiameterStrike: '', ConcealedFacilities: '', IsolationValve: '' },
                        { name: "窨井", IstrueOrFalse: '', PipeDiameterStrike: '', ConcealedFacilities: '', IsolationValve: '' },
                        { name: "压缩气体", IstrueOrFalse: '', PipeDiameterStrike: '', ConcealedFacilities: '', IsolationValve: '' },
                        { name: "电气仪表线路", IstrueOrFalse: '', PipeDiameterStrike: '', ConcealedFacilities: '', IsolationValve: '' },
                        { name: "工艺管线", IstrueOrFalse: '', PipeDiameterStrike: '', ConcealedFacilities: '', IsolationValve: '' },
                        { name: "消防管线", IstrueOrFalse: '', PipeDiameterStrike: '', ConcealedFacilities: '', IsolationValve: '' },
                        { name: "其它隐蔽设施", IstrueOrFalse: '', PipeDiameterStrike: '', ConcealedFacilities: '', IsolationValve: '' },
                        { name: "其它", IstrueOrFalse: '', PipeDiameterStrike: '', ConcealedFacilities: '', IsolationValve: '' }];
                    myuser.applicant = Mock.Random.cname();
                    myuser.ApplicationUnit = randomValue("08");
                    myuser.Approver = [];//审批人
                    myuser.AffectedParties = []; //受影响相关方
                    myuser.Groundworker = [];
                    myuser.Guardian = [];
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            case '/api/EarthmovingWorkSafetyPermit/getRish': Mock.mock(host + url + '?' + param, type, function (options) {
                var id = parent.app.Form.BasedDatabaseManagementRequirements;
                var myuser = {
                    OperationRelatedActivitiesRish: [], ActivityRish: [], OperatingProcedureRish: [], InspectionMaintenanceActivitiesRish: [],
                    EquipmentFacilitiesRish: [], ProcessMediumRish: [], PlaceEnvironmentRish: []
                };
                for (var i = 0; i < id.length; i++) {
                    if (id[i].RiskTypeId == 0) {
                        myuser.OperationRelatedActivitiesRish.push(id[i]);
                        continue;
                    } else if (id[i].RiskTypeId == 1) {
                        myuser.ActivityRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 2) {
                        myuser.OperatingProcedureRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 3) {
                        myuser.InspectionMaintenanceActivitiesRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 4) {
                        myuser.EquipmentFacilitiesRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 5) {
                        myuser.ProcessMediumRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 6) {
                        myuser.PlaceEnvironmentRish.push(id[i]);
                        continue;
                    }
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            ////提交
            case '/api/EarthmovingWorkSafetyPermit/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$EarthmovingWorkSafetyPermit.EquipmenFacilities;
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].OperatingUnit = thisuser.OperatingUnit;
                        thisUsers[i].ApplicationNumber = thisuser.ApplicationNumber;
                        thisUsers[i].ApplicationTime = thisuser.ApplicationTime;
                        thisUsers[i].ApplicationUnit = thisuser.ApplicationUnit;
                        thisUsers[i].JobManagere = thisuser.JobManagere;
                        thisUsers[i].OperatingName = thisuser.OperatingName;
                        thisUsers[i].applicant = thisuser.applicant;
                        thisUsers[i].JobLocation = thisuser.JobLocation;
                        thisUsers[i].JobStartTime = thisuser.JobStartTime;
                        thisUsers[i].JobEndTime = thisuser.JobEndTime;
                        thisUsers[i].applicant = thisuser.applicant;
                        thisUsers[i].CurrentJob = thisuser.CurrentJob;
                        thisUsers[i].IsSafeWorkProgram = thisuser.IsSafeWorkProgram;
                        thisUsers[i].contractor = thisuser.contractor;
                        thisUsers[i].ConcealedFacilities = thisuser.ConcealedFacilities;
                        thisUsers[i].TestingRequirements = thisuser.TestingRequirements;
                        thisUsers[i].HazardIdentification = thisuser.HazardIdentification;
                        thisUsers[i].BasedDatabaseManagementRequirements = thisuser.BasedDatabaseManagementRequirements;
                        thisUsers[i].Approver = thisuser.Approver;
                        thisUsers[i].AffectedParties = thisuser.AffectedParties;
                        thisUsers[i].Groundworker = thisuser.Groundworker;
                        thisUsers[i].Guardian = thisuser.Guardian;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    //Input 页面需要 去操作List页面的数组 parent
                    parent.$EarthmovingWorkSafetyPermit.EquipmenFacilities.push({
                        id: Mock.Random.id(),
                        OperatingUnit: thisuser.OperatingUnit,
                        ApplicationUnit: thisuser.ApplicationUnit,
                        ApplicationNumber: thisuser.ApplicationNumber,
                        ApplicationTime: '2019-08-20',
                        JobManagere: thisuser.JobManagere,
                        OperatingName: thisuser.OperatingName,
                        applicant: thisuser.applicant,
                        JobLocation: thisuser.JobLocation,
                        JobStartTime: '2019-08-20',
                        JobEndTime: '2019-08-20',
                        EarthContent: thisuser.EarthContent,
                        CurrentJob: randomValue("18"),
                        IsSafeWorkProgram: thisuser.IsSafeWorkProgram,
                        contractor: thisuser.contractor,
                        ConcealedFacilities: thisuser.ConcealedFacilities,
                        HazardIdentification: thisuser.HazardIdentification,
                        BasedDatabaseManagementRequirements: thisuser.BasedDatabaseManagementRequirements,
                        Approver: thisuser.Approver,
                        AffectedParties: thisuser.AffectedParties,
                        Groundworker: thisuser.Groundworker,
                        Guardian: thisuser.Guardian,
                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 30; i++) {
            $EarthmovingWorkSafetyPermit.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                ApplicationUnit: randomValue("08"),//申请单位
                OperatingUnit: randomValue("08"),//作业单位
                ApplicationNumber: Mock.Random.id(),//申请编号
                ApplicationTime: Mock.mock('@date()'),//申请时间
                applicant: Mock.Random.cname(),//  "申请人",
                OperatingName: Mock.Random.cname(),//"作业名称",
                JobManagere: Mock.Random.cname(),//作业负责人
                JobLocation: randomValue("97"),//作业地点
                JobStartTime: Mock.Random.datetime(),//作业起始时间
                JobEndTime: Mock.Random.datetime(),//有效截至时间
                EarthContent: Mock.Random.id(),//吊装内容描述
                IsSafeWorkProgram: randomValue("50"),//是否附安全工作方案
                contractor: randomValue("12"),//承包商
                CurrentJob: randomValue("18"),//当前作业
                ConcealedFacilities:
                    [{ name: "公用设施线路", IstrueOrFalse: randomValue("50"), PipeDiameterStrike: Mock.Random.cname(), ConcealedFacilities: Mock.Random.cname(), IsolationValve: Mock.Random.cname() },
                    { name: "循环水管道", IstrueOrFalse: randomValue("50"), PipeDiameterStrike: Mock.Random.cname(), ConcealedFacilities: Mock.Random.cname(), IsolationValve: Mock.Random.cname() },
                    { name: "自来水管道", IstrueOrFalse: randomValue("50"), PipeDiameterStrike: Mock.Random.cname(), ConcealedFacilities: Mock.Random.cname(), IsolationValve: Mock.Random.cname() },
                    { name: "污水沟或管道", IstrueOrFalse: randomValue("50"), PipeDiameterStrike: Mock.Random.cname(), ConcealedFacilities: Mock.Random.cname(), IsolationValve: Mock.Random.cname() },
                    { name: "窨井", IsSakIstrueOrFalseai: randomValue("50"), PipeDiameterStrike: Mock.Random.cname(), ConcealedFacilities: Mock.Random.cname(), IsolationValve: Mock.Random.cname() },
                    { name: "压缩气体", IsCompressIstrueOrFalseedGas: randomValue("50"), PipeDiameterStrike: Mock.Random.cname(), ConcealedFacilities: Mock.Random.cname(), IsolationValve: Mock.Random.cname() },
                    { name: "电气仪表线路", IstrueOrFalse: randomValue("50"), PipeDiameterStrike: Mock.Random.cname(), ConcealedFacilities: Mock.Random.cname(), IsolationValve: Mock.Random.cname() },
                    { name: "工艺管线", IstrueOrFalse: randomValue("50"), PipeDiameterStrike: Mock.Random.cname(), ConcealedFacilities: Mock.Random.cname(), IsolationValve: Mock.Random.cname() },
                    { name: "消防管线", IstrueOrFalse: randomValue("50"), PipeDiameterStrike: Mock.Random.cname(), ConcealedFacilities: Mock.Random.cname(), IsolationValve: Mock.Random.cname() },
                    { name: "其它隐蔽设施", IstrueOrFalse: randomValue("50"), PipeDiameterStrike: Mock.Random.cname(), ConcealedFacilities: Mock.Random.cname(), IsolationValve: Mock.Random.cname() },
                    { name: "其它", IstrueOrFalse: randomValue("50"), PipeDiameterStrike: Mock.Random.cname(), ConcealedFacilities: Mock.Random.cname(), IsolationValve: Mock.Random.cname() }],
                HazardIdentification: HazardIdentification(),//危害辨识
                BasedDatabaseManagementRequirements: BasedDatabaseManagementRequirements(),//基于数据库管控要求
                Approver: [{ ApproverUnit: randomValue("08"), ApproverConfirmor: randomValue("09") }],//审批人
                AffectedParties: [{ AffectedPartiesUnit: randomValue("08"), AffectedPartiesConfirmor: randomValue("09") }],//受影响相关方
                Groundworker: [{ GroundUnit: randomValue("08"), GroundConfirmor: randomValue("09") }],//动土作业人
                Guardian: [{ GuardianUnit: randomValue("08"), GuardianConfirmor: randomValue("09") }],//动土作业人
            }));
        }
    }
}

//断路作业安全许可证
var $OpenCircuitSafetyPermit = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            //删除
            case '/api/OpenCircuitSafetyPermit/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $OpenCircuitSafetyPermit.EquipmenFacilities.length; i++) {
                    temp.push($OpenCircuitSafetyPermit.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $OpenCircuitSafetyPermit.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/OpenCircuitSafetyPermit/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($OpenCircuitSafetyPermit.EquipmenFacilities.length == 0) {
                        $OpenCircuitSafetyPermit.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var ApplicationNumber = p.model.ApplicationNumber;
                    var OperatingUnit = getDicValue("08", p.model.OperatingUnit);
                    var JobManagere = p.model.JobManagere;
                    //var TerritorialDepartment = getDicValue("14", p.model.OperatingName);
                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $OpenCircuitSafetyPermit.EquipmenFacilities.length; i++) {
                        var user = $OpenCircuitSafetyPermit.EquipmenFacilities[i];
                        if (ApplicationNumber && user.ApplicationNumber.indexOf(ApplicationNumber) == -1)
                            continue;
                        if (OperatingUnit && user.OperatingUnit.indexOf(OperatingUnit) == -1)
                            continue;
                        if (JobManagere && user.JobManagere.indexOf(JobManagere) == -1)
                            continue;
                        //if (TerritorialDepartment && user.TerritorialDepartment.indexOf(TerritorialDepartment) == -1)
                        //    continue;
                        user.OperatingUnit = getDicValue("08", user.OperatingUnit) == '' ? user.OperatingUnit : getDicValue("08", user.OperatingUnit);
                        user.TerritorialDepartment = getDicValue("14", user.TerritorialDepartment) == '' ? user.TerritorialDepartment : getDicValue("14", user.TerritorialDepartment);

                        limitUsers2.push(user);

                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
            //获取Input数据
            case '/api/OpenCircuitSafetyPermit/get': Mock.mock(host + url + '?' + param, type, function (options) {

                var myUsers = parent.$OpenCircuitSafetyPermit.EquipmenFacilities;
                myuser = {};
                var bool = true;
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        bool = false
                        break;
                    }
                }
                //新增
                if (bool) {
                    myuser.ApplicationNumber = Mock.Random.id();
                    myuser.HazardIdentification = HazardIdentificationA();
                    myuser.ApplicationUnit = randomValue("08");
                    myuser.Approver = [];//审批人
                    myuser.AffectedParties = [];//受影响相关方
                    myuser.Disconnection = [];
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            case '/api/OpenCircuitSafetyPermit/getRish': Mock.mock(host + url + '?' + param, type, function (options) {
                var id = parent.app.Form.BasedDatabaseManagementRequirements;
                var myuser = {
                    OperationRelatedActivitiesRish: [], ActivityRish: [], OperatingProcedureRish: [], InspectionMaintenanceActivitiesRish: [],
                    EquipmentFacilitiesRish: [], ProcessMediumRish: [], PlaceEnvironmentRish: []
                };
                for (var i = 0; i < id.length; i++) {
                    if (id[i].RiskTypeId == 0) {
                        myuser.OperationRelatedActivitiesRish.push(id[i]);
                        continue;
                    } else if (id[i].RiskTypeId == 1) {
                        myuser.ActivityRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 2) {
                        myuser.OperatingProcedureRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 3) {
                        myuser.InspectionMaintenanceActivitiesRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 4) {
                        myuser.EquipmentFacilitiesRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 5) {
                        myuser.ProcessMediumRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 6) {
                        myuser.PlaceEnvironmentRish.push(id[i]);
                        continue;
                    }
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            ////提交
            case '/api/OpenCircuitSafetyPermit/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$OpenCircuitSafetyPermit.EquipmenFacilities;
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].OperatingUnit = thisuser.OperatingUnit;
                        thisUsers[i].ApplicationNumber = thisuser.ApplicationNumber;
                        thisUsers[i].ApplicationTime = thisuser.ApplicationTime;
                        thisUsers[i].ApplicationUnit = thisuser.ApplicationUnit;
                        thisUsers[i].JobManagere = thisuser.JobManagere;
                        thisUsers[i].OperatingName = thisuser.OperatingName;
                        thisUsers[i].JobLocation = thisuser.JobLocation;
                        thisUsers[i].JobStartTime = thisuser.JobStartTime;
                        thisUsers[i].JobEndTime = thisuser.JobEndTime;
                        thisUsers[i].TerritorialDepartment = thisuser.TerritorialDepartment;
                        thisUsers[i].CurrentJob = thisuser.CurrentJob;
                        thisUsers[i].CauseDisconnection = thisuser.CauseDisconnection;
                        thisUsers[i].contractor = thisuser.contractor;
                        thisUsers[i].SchematicDiagram = thisuser.SchematicDiagram;
                        thisUsers[i].HazardIdentification = thisuser.HazardIdentification;
                        thisUsers[i].BasedDatabaseManagementRequirements = thisuser.BasedDatabaseManagementRequirements;
                        thisUsers[i].Approver = thisuser.Approver;
                        thisUsers[i].AffectedParties = thisuser.AffectedParties;
                        thisUsers[i].Disconnection = thisuser.Disconnection;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    //Input 页面需要 去操作List页面的数组 parent
                    parent.$OpenCircuitSafetyPermit.EquipmenFacilities.push({
                        id: Mock.Random.id(),
                        OperatingUnit: thisuser.OperatingUnit,
                        ApplicationNumber: thisuser.ApplicationNumber,
                        ApplicationUnit: thisuser.ApplicationUnit,
                        ApplicationTime: '2019-08-20',
                        JobManagere: thisuser.JobManagere,
                        OperatingName: thisuser.OperatingName,
                        JobLocation: '2019-08-20',
                        JobStartTime: '2019-08-20',
                        JobEndTime: thisuser.JobEndTime,
                        TerritorialDepartment: thisuser.TerritorialDepartment,
                        CurrentJob: randomValue("18"),
                        CauseDisconnection: thisuser.CauseDisconnection,
                        contractor: thisuser.contractor,
                        SchematicDiagram: thisuser.SchematicDiagram,
                        HazardIdentification: thisuser.HazardIdentification,
                        BasedDatabaseManagementRequirements: thisuser.BasedDatabaseManagementRequirements,
                        Approver: thisuser.Approver,
                        AffectedParties: thisuser.AffectedParties,
                        Disconnection: thisuser.Disconnection,

                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 30; i++) {
            $OpenCircuitSafetyPermit.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                ApplicationUnit: randomValue("08"),//申请单位
                OperatingUnit: randomValue("08"),//作业单位
                ApplicationNumber: Mock.Random.id(),//申请编号
                ApplicationTime: Mock.mock('@date()'),//申请时间
                OperatingName: Mock.Random.cname(),//"作业名称",
                JobManagere: Mock.Random.cname(),//作业负责人
                JobLocation: randomValue("97"),//作业地点
                JobStartTime: Mock.Random.datetime(),//作业起始时间
                JobEndTime: Mock.Random.datetime(),//有效截至时间
                TerritorialDepartment: randomValue("14"),//属地部门
                CurrentJob: randomValue("18"),//当前作业
                CauseDisconnection: Mock.mock('@cparagraph(1, 1)'),
                contractor: randomValue("12"),//承包商
                SchematicDiagram: Mock.mock('@cparagraph(1, 1)'),
                HazardIdentification: HazardIdentification(),//危害辨识
                BasedDatabaseManagementRequirements: BasedDatabaseManagementRequirements(),//基于数据库管控要求
                Approver: [{ ApproverUnit: randomValue("08"), ApproverConfirmor: randomValue("09") }],//审批人
                AffectedParties: [{ AffectedPartiesUnit: randomValue("08"), AffectedPartiesConfirmor: randomValue("09") }],//受影响相关方
                Disconnection: [{ DisconnectionUnit: randomValue("08"), DisconnectionConfirmor: randomValue("09") }]
            }));
        }
    }
}

//高处作业安全许可证管理
var $HighWorkSafetyPermit = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/HighWorkSafetyPermit/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $HighWorkSafetyPermit.EquipmenFacilities.length; i++) {
                    temp.push($HighWorkSafetyPermit.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $HighWorkSafetyPermit.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/HighWorkSafetyPermit/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($HighWorkSafetyPermit.EquipmenFacilities.length == 0) {
                        $HighWorkSafetyPermit.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var ApplicationNumber = p.model.ApplicationNumber;
                    var OperatingUnit = getDicValue("08", p.model.OperatingUnit);
                    var JobManagere = p.model.JobManagere;
                    var TerritorialDepartment = getDicValue("14", p.model.TerritorialDepartment);

                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $HighWorkSafetyPermit.EquipmenFacilities.length; i++) {
                        var user = $HighWorkSafetyPermit.EquipmenFacilities[i];
                        if (ApplicationNumber && user.ApplicationNumber.indexOf(ApplicationNumber) == -1)
                            continue;
                        if (OperatingUnit && user.OperatingUnit.indexOf(OperatingUnit) == -1)
                            continue;
                        if (JobManagere && user.JobManagere.indexOf(JobManagere) == -1)
                            continue;
                        if (TerritorialDepartment && user.TerritorialDepartment.indexOf(TerritorialDepartment) == -1)
                            continue;
                        user.OperatingUnit = getDicValue("08", user.OperatingUnit) == '' ? user.OperatingUnit : getDicValue("08", user.OperatingUnit);
                        user.TerritorialDepartment = getDicValue("14", user.TerritorialDepartment) == '' ? user.TerritorialDepartment : getDicValue("14", user.TerritorialDepartment);

                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;


            case '/api/HighWorkSafetyPermit/RelatedTable': Mock.mock(host + url, type,
                function (options) {
                    if ($HighWorkSafetyPermit.RelatedTable.length == 0) {
                        $HighWorkSafetyPermit.RelatedTableList();
                    }
                    var list = $HighWorkSafetyPermit.RelatedTableList();
                    var myUsers = parent.app.Form.RelatedForm;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    for (var i = 0; i < $HighWorkSafetyPermit.RelatedTable.length; i++) {
                        $HighWorkSafetyPermit.RelatedTable[i].RelatedFormName = myuser.RelatedFormName;
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var RelatedFormNo = p.model.RelatedFormNo;
                    var RelatedPeople = p.model.RelatedPeople;
                    var TerritorialDepartment = getDicValue("14", p.model.TerritorialDepartment);
                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $HighWorkSafetyPermit.RelatedTable.length; i++) {
                        var user = $HighWorkSafetyPermit.RelatedTable[i];
                        if (RelatedFormNo && user.RelatedFormNo.indexOf(RelatedFormNo) == -1)
                            continue;
                        if (RelatedPeople && user.RelatedPeople.indexOf(RelatedPeople) == -1)
                            continue;
                        if (TerritorialDepartment && user.TerritorialDepartment.indexOf(TerritorialDepartment) == -1)
                            continue;
                        //   user.TerritorialDepartment = getDicValue("14", user.TerritorialDepartment) == '' ? user.TerritorialDepartment : getDicValue("14", user.RelatedPeople);
                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;



            ////获取Input数据
            case '/api/HighWorkSafetyPermit/get': Mock.mock(host + url + '?' + param, type, function (options) {

                var myUsers = parent.$HighWorkSafetyPermit.EquipmenFacilities;
                myuser = {};
                var bool = true;
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        bool = false
                        break;
                    }
                }
                //新增
                if (bool) {
                    myuser.ApplicationNumber = Mock.Random.id();
                    myuser.HazardIdentification = HazardIdentificationA();
                    myuser.RelatedForm = HighWorkRelatedFormAdd();//相关表格
                    myuser.Operator = [];
                    myuser.HSESecurityOfficer = [];//HSE部安全员
                    myuser.Guardian = [];//HSE部安全员
                    myuser.TerritorialReviewer = [],//属地审核人
                        myuser.Production = [];//生产部/HSE部审核人
                    myuser.GeneralManager = [];
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            case '/api/HighWorkSafetyPermit/getRish': Mock.mock(host + url + '?' + param, type, function (options) {
                var id = parent.app.Form.BasedDatabaseManagementRequirements;
                var myuser = {
                    OperationRelatedActivitiesRish: [], ActivityRish: [], OperatingProcedureRish: [], InspectionMaintenanceActivitiesRish: [],
                    EquipmentFacilitiesRish: [], ProcessMediumRish: [], PlaceEnvironmentRish: []
                };
                for (var i = 0; i < id.length; i++) {
                    if (id[i].RiskTypeId == 0) {
                        myuser.OperationRelatedActivitiesRish.push(id[i]);
                        continue;
                    } else if (id[i].RiskTypeId == 1) {
                        myuser.ActivityRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 2) {
                        myuser.OperatingProcedureRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 3) {
                        myuser.InspectionMaintenanceActivitiesRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 4) {
                        myuser.EquipmentFacilitiesRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 5) {
                        myuser.ProcessMediumRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 6) {
                        myuser.PlaceEnvironmentRish.push(id[i]);
                        continue;
                    }
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            ////提交
            case '/api/HighWorkSafetyPermit/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$HighWorkSafetyPermit.EquipmenFacilities;
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].OperatingUnit = thisuser.OperatingUnit;
                        thisUsers[i].ApplicationNumber = thisuser.ApplicationNumber;
                        thisUsers[i].ApplicationTime = thisuser.ApplicationTime;
                        thisUsers[i].JobManagere = thisuser.JobManagere;
                        thisUsers[i].WorkingArea = thisuser.WorkingArea;
                        thisUsers[i].JobLocation = thisuser.JobLocation;
                        thisUsers[i].JobStartTime = thisuser.JobStartTime;
                        thisUsers[i].JobEndTime = thisuser.JobEndTime;
                        thisUsers[i].TerritorialDepartment = thisuser.TerritorialDepartment;
                        thisUsers[i].CurrentJob = thisuser.CurrentJob;
                        thisUsers[i].Level = thisuser.Level;
                        thisUsers[i].WorkContent = thisuser.WorkContent;
                        thisUsers[i].WorkHeight = thisuser.WorkHeight;
                        thisUsers[i].InvolvingOtherSpecialOperations = thisuser.InvolvingOtherSpecialOperations;
                        thisUsers[i].contractor = thisuser.contractor;
                        thisUsers[i].HazardIdentification = thisuser.HazardIdentification;
                        thisUsers[i].BasedDatabaseManagementRequirements = thisuser.BasedDatabaseManagementRequirements;
                        thisUsers[i].Operator = thisuser.Operator;
                        thisUsers[i].HSESecurityOfficer = thisuser.HSESecurityOfficer;
                        thisUsers[i].Guardian = thisuser.Guardian;
                        thisUsers[i].TerritorialReviewer = thisuser.TerritorialReviewer;
                        thisUsers[i].Production = thisuser.Production;
                        thisUsers[i].GeneralManager = thisuser.GeneralManager;
                        thisUsers[i].RelatedForm = thisuser.RelatedForm;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    //Input 页面需要 去操作List页面的数组 parent
                    parent.$HighWorkSafetyPermit.EquipmenFacilities.push({
                        id: Mock.Random.id(),
                        OperatingUnit: thisuser.OperatingUnit,
                        ApplicationNumber: thisuser.ApplicationNumber,
                        ApplicationTime: '2019-08-20',
                        WorkingArea: thisuser.WorkingArea,
                        JobManagere: thisuser.JobManagere,
                        JobLocation: thisuser.JobLocation,
                        JobStartTime: '2019-08-20',
                        JobEndTime: '2019-08-20',
                        TerritorialDepartment: thisuser.TerritorialDepartment,
                        CurrentJob: randomValue("18"),
                        Level: thisuser.Level,
                        WorkContent: thisuser.WorkContent,
                        WorkHeight: thisuser.WorkHeight,
                        InvolvingOtherSpecialOperations: thisuser.InvolvingOtherSpecialOperations,
                        contractor: thisuser.contractor,
                        HazardIdentification: thisuser.HazardIdentification,
                        BasedDatabaseManagementRequirements: thisuser.BasedDatabaseManagementRequirements,
                        Operator: thisuser.Operator,
                        HSESecurityOfficer: thisuser.HSESecurityOfficer,
                        Guardian: thisuser.Guardian,
                        TerritorialReviewer: thisuser.TerritorialReviewer,
                        Production: thisuser.Production,
                        GeneralManager: thisuser.GeneralManager,
                        RelatedForm: thisuser.RelatedForm,
                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 30; i++) {
            $HighWorkSafetyPermit.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                OperatingUnit: randomValue("08"),//作业单位
                ApplicationNumber: Mock.Random.id(),//申请编号
                ApplicationTime: Mock.mock('@date()'),//申请时间
                WorkingArea: randomValue("97"),//作业区域
                JobManagere: Mock.Random.cname(),//作业负责人
                JobLocation: randomValue("97"),//作业地点
                JobStartTime: Mock.Random.datetime(),//作业起始时间
                JobEndTime: Mock.Random.datetime(),//有效截至时间
                TerritorialDepartment: randomValue("14"),//属地部门
                CurrentJob: randomValue("18"),//当前作业
                Level: randomValue("03"),//等级
                WorkContent: Mock.mock('@natural()'),//作业描述
                WorkHeight: i,//作业高度(米)
                InvolvingOtherSpecialOperations: Mock.mock('@cparagraph(1, 1)'),//涉及其他特殊作业
                contractor: randomValue("12"),//承包商
                HazardIdentification: HazardIdentification(),//危害辨识
                BasedDatabaseManagementRequirements: BasedDatabaseManagementRequirements(),//基于数据库管控要求
                Operator: [{ OperatorUnit: randomValue("08"), OperatorConfirmor: randomValue("09") }],//作业人
                HSESecurityOfficer: [{ HSESecurityOfficerUnit: randomValue("08"), HSESecurityOfficerConfirmor: randomValue("09") }],//HSE部安全员
                Guardian: [{ GuardianUnit: randomValue("08"), GuardianConfirmor: randomValue("09") }],//HSE部安全员
                TerritorialReviewer: [{ TerritorialReviewerUnit: randomValue("08"), TerritorialReviewerConfirmor: randomValue("09") }],//属地审核人
                Production: [{ ProductionUnit: randomValue("08"), ProductionConfirmor: randomValue("09") }],//生产部/HSE部审核人
                GeneralManager: [{ GeneralManagerUnit: randomValue("08"), GeneralManagerConfirmor: randomValue("09") }],//总经理/生产部和HSE部经理会签审核
                RelatedForm: HighWorkRelatedForm(),//相关表格
            }));
        }
    },
    RelatedTable: [],
    RelatedTableList: function () {
        for (var i = 0; i < 10; i++) {
            $HighWorkSafetyPermit.RelatedTable.push(Mock.mock({
                id: Mock.Random.id(),
                RelatedFormName: '',
                RelatedFormNo: Mock.Random.id(),
                RelatedPeople: Mock.Random.cname(),//申请人
                RelatedTime: Mock.mock('@date()') //时间
            }));
        }
    }
}
function HighWorkRelatedForm() {
    var RelatedFormList = [];
    for (var i = 3; i < 4; i++) {
        var RelatedForm = {};
        RelatedForm.id = i;
        RelatedForm.RelatedFormName = getDicValue("93", i);
        RelatedForm.RelatedFormNo = Mock.Random.id();
        RelatedFormList.push(RelatedForm);
    }
    return RelatedFormList;
}
function HighWorkRelatedFormAdd() {
    var RelatedFormList = [];
    for (var i = 3; i < 4; i++) {
        var RelatedForm = {};
        RelatedForm.id = i;
        RelatedForm.RelatedFormName = getDicValue("93", i);
        RelatedFormList.push(RelatedForm);
    }
    return RelatedFormList;
}


//脚手架检查表
var $ScaffoldingChecklist = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            //删除
            case '/api/ScaffoldingChecklist/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $ScaffoldingChecklist.EquipmenFacilities.length; i++) {
                    temp.push($ScaffoldingChecklist.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $ScaffoldingChecklist.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/ScaffoldingChecklist/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($ScaffoldingChecklist.EquipmenFacilities.length == 0) {
                        $ScaffoldingChecklist.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var ProjectNumber = p.model.ProjectNumber;
                    var ProjectName = p.model.ProjectName;
                    var RelatedPeople = getDicValue("09", p.model.RelatedPeople);;
                    var ScaffoldingInspector = getDicValue("09", p.model.ScaffoldingInspector);
                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $ScaffoldingChecklist.EquipmenFacilities.length; i++) {
                        var user = $ScaffoldingChecklist.EquipmenFacilities[i];
                        if (ProjectNumber && user.ProjectNumber.indexOf(ProjectNumber) == -1)
                            continue;
                        if (ProjectName && user.ProjectName.indexOf(ProjectName) == -1)
                            continue;
                        if (RelatedPeople && user.RelatedPeople.indexOf(RelatedPeople) == -1)
                            continue;
                        if (ScaffoldingInspector && user.ScaffoldingInspector.indexOf(ScaffoldingInspector) == -1)
                            continue;
                        user.RelatedPeople = getDicValue("09", user.RelatedPeople) == '' ? user.RelatedPeople : getDicValue("09", user.RelatedPeople);
                        user.OperatingUnit = getDicValue("08", user.OperatingUnit) == '' ? user.OperatingUnit : getDicValue("08", user.OperatingUnit);
                        user.ScaffoldingInspector = getDicValue("09", user.ScaffoldingInspector) == '' ? user.ScaffoldingInspector : getDicValue("09", user.ScaffoldingInspector);
                        limitUsers2.push(user);
                    }
                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
            ////获取Input数据
            case '/api/ScaffoldingChecklist/get': Mock.mock(host + url + '?' + param, type, function (options) {
                var myUsers = parent.$ScaffoldingChecklist.EquipmenFacilities;
                myuser = {};
                var bool = true;

                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        bool = false
                        break;
                    }
                }
                //新增
                if (bool) {
                    myuser.ProjectNumber = Mock.Random.id();//编号;
                    myuser.CheckItem = CheckItemAdd();

                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            ////提交
            case '/api/ScaffoldingChecklist/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$ScaffoldingChecklist.EquipmenFacilities;
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].ProjectNumber = thisuser.ProjectNumber;
                        thisUsers[i].ProjectName = thisuser.ProjectName;
                        thisUsers[i].JobLocation = thisuser.JobLocation;
                        thisUsers[i].OperatingUnit = thisuser.OperatingUnit;
                        thisUsers[i].RelatedPeople = thisuser.RelatedPeople;
                        thisUsers[i].ScaffoldingInspector = thisuser.ScaffoldingInspector;
                        thisUsers[i].CheckTime = thisuser.CheckTime;
                        thisUsers[i].OverallResult = thisuser.OverallResult;
                        thisUsers[i].CheckItem = thisuser.CheckItem;
                        thisUsers[i].OtherSpecialRequirements = thisuser.OtherSpecialRequirements;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    //Input 页面需要 去操作List页面的数组 parent
                    parent.$ScaffoldingChecklist.EquipmenFacilities.push({
                        id: Mock.Random.id(),
                        ProjectNumber: thisuser.ProjectNumber,
                        ProjectName: thisuser.ProjectName,
                        JobLocation: thisuser.JobLocation,
                        OperatingUnit: thisuser.OperatingUnit,
                        RelatedPeople: thisuser.RelatedPeople,
                        ScaffoldingInspector: thisuser.ScaffoldingInspector,
                        CheckTime: thisuser.CheckTime,
                        OverallResult: thisuser.OverallResult,
                        CheckItem: thisuser.CheckItem,
                        OtherSpecialRequirements: thisuser.OtherSpecialRequirements,
                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 80; i++) {
            $ScaffoldingChecklist.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                ProjectNumber: Mock.Random.id(),//编号
                ProjectName: randomValue("n111"),
                JobLocation: randomValue("97"),//作业地点
                OperatingUnit: randomValue("08"),//作业单位名称
                RelatedPeople: randomValue("09"),//检查人
                ScaffoldingInspector: randomValue("09"),
                CheckTime: Mock.Random.datetime(),//时间
                OverallResult: randomValue("123"),
                CheckItem: CheckItem(),
                OtherSpecialRequirements: Mock.mock('@cparagraph(1, 1)'),
            }));
        }
    }
}

function CheckItem() {
    var CheckItemList = [];
    for (var i = 0; i < 15; i++) {
        var CheckItem = {};
        CheckItem.id = i;
        CheckItem.CheckContent = getDicValue("125", i);
        CheckItem.SingleResult = randomValue("124");
        CheckItem.Remarks = Mock.mock('@cparagraph(1, 1)');
        CheckItemList.push(CheckItem);
    }
    return CheckItemList;
}

function CheckItemAdd() {
    var CheckItemList = [];
    for (var i = 0; i < 15; i++) {
        var CheckItem = {};
        CheckItem.id = i;
        CheckItem.CheckContent = getDicValue("125", i);
        CheckItem.SingleResult = '';
        CheckItem.Remarks = '';
        CheckItemList.push(CheckItem);
    }
    return CheckItemList;
}

//管线打开作业安全许可证管理
var $PipelineOpenOperationSafetyLicense = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/PipelineOpenOperationSafetyLicense/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $PipelineOpenOperationSafetyLicense.EquipmenFacilities.length; i++) {
                    temp.push($PipelineOpenOperationSafetyLicense.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $PipelineOpenOperationSafetyLicense.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/PipelineOpenOperationSafetyLicense/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($PipelineOpenOperationSafetyLicense.EquipmenFacilities.length == 0) {
                        $PipelineOpenOperationSafetyLicense.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var ApplicationNumber = p.model.ApplicationNumber;
                    var OperatingUnit = getDicValue("08", p.model.OperatingUnit);
                    var JobManagere = p.model.JobManagere;
                    var TerritorialDepartment = getDicValue("14", p.model.TerritorialDepartment);

                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $PipelineOpenOperationSafetyLicense.EquipmenFacilities.length; i++) {
                        var user = $PipelineOpenOperationSafetyLicense.EquipmenFacilities[i];
                        if (ApplicationNumber && user.ApplicationNumber.indexOf(ApplicationNumber) == -1)
                            continue;
                        if (OperatingUnit && user.OperatingUnit.indexOf(OperatingUnit) == -1)
                            continue;
                        if (JobManagere && user.JobManagere.indexOf(JobManagere) == -1)
                            continue;
                        if (TerritorialDepartment && user.TerritorialDepartment.indexOf(TerritorialDepartment) == -1)
                            continue;
                        user.OperatingUnit = getDicValue("08", user.OperatingUnit) == '' ? user.OperatingUnit : getDicValue("08", user.OperatingUnit);
                        user.TerritorialDepartment = getDicValue("14", user.TerritorialDepartment) == '' ? user.TerritorialDepartment : getDicValue("14", user.TerritorialDepartment);

                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;


            case '/api/PipelineOpenOperationSafetyLicense/RelatedTable': Mock.mock(host + url, type,
                function (options) {
                    if ($PipelineOpenOperationSafetyLicense.RelatedTable.length == 0) {
                        $PipelineOpenOperationSafetyLicense.RelatedTableList();
                    }
                    var list = $PipelineOpenOperationSafetyLicense.RelatedTableList();
                    var myUsers = parent.app.Form.RelatedForm;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    for (var i = 0; i < $PipelineOpenOperationSafetyLicense.RelatedTable.length; i++) {
                        $PipelineOpenOperationSafetyLicense.RelatedTable[i].RelatedFormName = myuser.RelatedFormName;
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var ApplicationNumber = p.model.ApplicationNumber;
                    var RelatedFormNo = p.model.RelatedFormNo;
                    var RelatedPeople = p.model.RelatedPeople;
                    var TerritorialDepartment = getDicValue("14", p.model.TerritorialDepartment);
                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $PipelineOpenOperationSafetyLicense.RelatedTable.length; i++) {
                        var user = $PipelineOpenOperationSafetyLicense.RelatedTable[i];
                        if (ApplicationNumber && user.ApplicationNumber.indexOf(ApplicationNumber) == -1)
                            continue;
                        if (RelatedFormNo && user.RelatedFormNo.indexOf(RelatedFormNo) == -1)
                            continue;
                        if (RelatedPeople && user.RelatedPeople.indexOf(RelatedPeople) == -1)
                            continue;
                        if (TerritorialDepartment && user.TerritorialDepartment.indexOf(TerritorialDepartment) == -1)
                            continue;
                        //   user.TerritorialDepartment = getDicValue("14", user.TerritorialDepartment) == '' ? user.TerritorialDepartment : getDicValue("14", user.RelatedPeople);
                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;



            ////获取Input数据
            case '/api/PipelineOpenOperationSafetyLicense/get': Mock.mock(host + url + '?' + param, type, function (options) {

                var myUsers = parent.$PipelineOpenOperationSafetyLicense.EquipmenFacilities;
                myuser = {};
                var bool = true;
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        bool = false
                        break;
                    }
                }
                //新增
                if (bool) {
                    myuser.ApplicationNumber = Mock.Random.id();
                    myuser.ApplicationTime = '2019-08-20';
                    // myuser.HazardIdentification = HazardIdentificationA();
                    myuser.RelatedForm = PipelineOpenFormAdd();//相关表格
                    myuser.AffectedParties = [];//HSE部安全员
                    myuser.Approver = [],//属地审核人
                        myuser.Guardian = [];//生产部/HSE部审核人
                    myuser.Operator = [];
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            case '/api/PipelineOpenOperationSafetyLicense/getRish': Mock.mock(host + url + '?' + param, type, function (options) {
                var id = parent.app.Form.BasedDatabaseManagementRequirements;
                var myuser = {
                    OperationRelatedActivitiesRish: [], ActivityRish: [], OperatingProcedureRish: [], InspectionMaintenanceActivitiesRish: [],
                    EquipmentFacilitiesRish: [], ProcessMediumRish: [], PlaceEnvironmentRish: []
                };
                for (var i = 0; i < id.length; i++) {
                    if (id[i].RiskTypeId == 0) {
                        myuser.OperationRelatedActivitiesRish.push(id[i]);
                        continue;
                    } else if (id[i].RiskTypeId == 1) {
                        myuser.ActivityRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 2) {
                        myuser.OperatingProcedureRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 3) {
                        myuser.InspectionMaintenanceActivitiesRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 4) {
                        myuser.EquipmentFacilitiesRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 5) {
                        myuser.ProcessMediumRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 6) {
                        myuser.PlaceEnvironmentRish.push(id[i]);
                        continue;
                    }
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            ////提交
            case '/api/PipelineOpenOperationSafetyLicense/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$PipelineOpenOperationSafetyLicense.EquipmenFacilities;
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].OperatingUnit = thisuser.OperatingUnit;
                        thisUsers[i].ApplicationNumber = thisuser.ApplicationNumber;
                        thisUsers[i].ApplicationTime = thisuser.ApplicationTime;
                        thisUsers[i].JobManagere = thisuser.JobManagere;
                        thisUsers[i].WorkingArea = thisuser.WorkingArea;
                        thisUsers[i].JobLocation = thisuser.JobLocation;
                        thisUsers[i].JobStartTime = thisuser.JobStartTime;
                        thisUsers[i].JobEndTime = thisuser.JobEndTime;
                        thisUsers[i].TerritorialDepartment = thisuser.TerritorialDepartment;
                        thisUsers[i].CurrentJob = thisuser.CurrentJob;
                        thisUsers[i].DangerousMedium = thisuser.DangerousMedium;
                        thisUsers[i].WorkContent = thisuser.WorkContent;
                        thisUsers[i].AttachEquipmentJSA = thisuser.AttachEquipmentJSA;
                        thisUsers[i].contractor = thisuser.contractor;
                        thisUsers[i].CleanUp = thisuser.CleanUp;
                        thisUsers[i].Isolation = thisuser.Isolation;
                        thisUsers[i].GasLeakControlDevice = thisuser.GasLeakControlDevice;
                        thisUsers[i].PersonalProtectiveEquipment = thisuser.PersonalProtectiveEquipment;
                        thisUsers[i].BasedDatabaseManagementRequirements = thisuser.BasedDatabaseManagementRequirements;
                        thisUsers[i].AffectedParties = thisuser.AffectedParties;
                        thisUsers[i].Approver = thisuser.Approver;
                        thisUsers[i].Guardian = thisuser.Guardian;
                        thisUsers[i].Operator = thisuser.Operator;
                        thisUsers[i].RelatedForm = thisuser.RelatedForm;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    //Input 页面需要 去操作List页面的数组 parent
                    parent.$PipelineOpenOperationSafetyLicense.EquipmenFacilities.push({
                        id: Mock.Random.id(),
                        OperatingUnit: thisuser.OperatingUnit,
                        ApplicationNumber: thisuser.ApplicationNumber,
                        ApplicationTime: '2019-08-20',
                        WorkingArea: thisuser.WorkingArea,
                        JobManagere: thisuser.JobManagere,
                        JobLocation: thisuser.JobLocation,
                        JobStartTime: '2019-08-20',
                        JobEndTime: '2019-08-20',
                        TerritorialDepartment: thisuser.TerritorialDepartment,
                        CurrentJob: randomValue("18"),
                        DangerousMedium: thisuser.DangerousMedium,
                        WorkContent: thisuser.WorkContent,
                        AttachEquipmentJSA: thisuser.AttachEquipmentJSA,
                        contractor: thisuser.contractor,
                        CleanUp: thisuser.CleanUp,
                        Isolation: thisuser.Isolation,
                        GasLeakControlDevice: thisuser.GasLeakControlDevice,
                        PersonalProtectiveEquipment: thisuser.PersonalProtectiveEquipment,
                        BasedDatabaseManagementRequirements: thisuser.BasedDatabaseManagementRequirements,
                        AffectedParties: thisuser.AffectedParties,
                        Approver: thisuser.Approver,
                        Guardian: thisuser.Guardian,
                        Operator: thisuser.Operator,
                        RelatedForm: thisuser.RelatedForm,
                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 30; i++) {
            $PipelineOpenOperationSafetyLicense.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                OperatingUnit: randomValue("08"),//作业单位
                ApplicationNumber: Mock.Random.id(),//申请编号
                ApplicationTime: Mock.mock('@date()'),//申请时间
                WorkingArea: randomValue("97"),//作业区域
                JobManagere: Mock.Random.cname(),//作业负责人
                JobLocation: randomValue("97"),//作业地点
                JobStartTime: Mock.Random.datetime(),//作业起始时间
                JobEndTime: Mock.Random.datetime(),//有效截至时间
                TerritorialDepartment: randomValue("14"),//属地部门
                CurrentJob: randomValue("18"),//当前作业
                DangerousMedium: randomValue("126", 3),//涉及的危险介质（包括第二能源）有
                WorkContent: Mock.mock('@natural()'),//作业描述
                AttachEquipmentJSA: Mock.mock('@cparagraph(1, 1)'),// 附管线（设备）打开JSA
                contractor: randomValue("12"),//承包商
                CleanUp: randomValue("127", 3),//清理
                Isolation: randomValue("128", 3),//隔离
                GasLeakControlDevice: randomValue("129", 3),//液/气泄漏的控制设备
                PersonalProtectiveEquipment: randomValue("131", 3),//个人防护装备
                BasedDatabaseManagementRequirements: BasedDatabaseManagementRequirements(),//基于数据库管控要求
                AffectedParties: [{ AffectedPartiesUnit: randomValue("08"), AffectedPartiesConfirmor: randomValue("09") }],//受影响相关方
                Approver: [{ ApproverUnit: randomValue("08"), ApproverConfirmor: randomValue("09") }],//审批人
                Guardian: [{ GuardianUnit: randomValue("08"), GuardianConfirmor: randomValue("09") }],//HSE部安全员
                Operator: [{ OperatorUnit: randomValue("08"), OperatorConfirmor: randomValue("09") }],//作业人
                RelatedForm: PipelineOpenForm(),//相关表格
            }));
        }
    },
    RelatedTable: [],
    RelatedTableList: function () {
        for (var i = 0; i < 10; i++) {
            $PipelineOpenOperationSafetyLicense.RelatedTable.push(Mock.mock({
                id: Mock.Random.id(),
                RelatedFormName: '',
                RelatedFormNo: Mock.Random.id(),
                RelatedPeople: Mock.Random.cname(),//申请人
                RelatedTime: Mock.mock('@date()') //时间
            }));
        }
    }
}
function PipelineOpenForm() {
    var RelatedFormList = [];
    for (var i = 4; i < 5; i++) {
        var RelatedForm = {};
        RelatedForm.id = i;
        RelatedForm.RelatedFormName = getDicValue("93", i);
        RelatedForm.RelatedFormNo = Mock.Random.id();
        RelatedFormList.push(RelatedForm);
    }
    return RelatedFormList;
}
function PipelineOpenFormAdd() {
    var RelatedFormList = [];
    for (var i = 4; i < 5; i++) {
        var RelatedForm = {};
        RelatedForm.id = i;
        RelatedForm.RelatedFormName = getDicValue("93", i);
        RelatedFormList.push(RelatedForm);
    }
    return RelatedFormList;
}



//临电作业安全许可证管理
var $TemporaryOperationSafetyLicense = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            //删除
            case '/api/TemporaryOperationSafetyLicense/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $TemporaryOperationSafetyLicense.EquipmenFacilities.length; i++) {
                    temp.push($TemporaryOperationSafetyLicense.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $TemporaryOperationSafetyLicense.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/TemporaryOperationSafetyLicense/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($TemporaryOperationSafetyLicense.EquipmenFacilities.length == 0) {
                        $TemporaryOperationSafetyLicense.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var ApplicationNumber = p.model.ApplicationNumber;
                    var OperatingUnit = getDicValue("08", p.model.OperatingUnit);
                    var applicant = p.model.applicant;
                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $TemporaryOperationSafetyLicense.EquipmenFacilities.length; i++) {
                        var user = $TemporaryOperationSafetyLicense.EquipmenFacilities[i];
                        if (ApplicationNumber && user.ApplicationNumber.indexOf(ApplicationNumber) == -1)
                            continue;
                        if (OperatingUnit && user.OperatingUnit.indexOf(OperatingUnit) == -1)
                            continue;
                        if (applicant && user.applicant.indexOf(applicant) == -1)
                            continue;
                        user.OperatingUnit = getDicValue("08", user.OperatingUnit) == '' ? user.OperatingUnit : getDicValue("08", user.OperatingUnit);
                        limitUsers2.push(user);

                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
            //获取Input数据
            case '/api/TemporaryOperationSafetyLicense/get': Mock.mock(host + url + '?' + param, type, function (options) {

                var myUsers = parent.$TemporaryOperationSafetyLicense.EquipmenFacilities;
                myuser = {};
                var bool = true;
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        bool = false
                        break;
                    }
                }
                //新增
                if (bool) {
                    myuser.ApplicationNumber = Mock.Random.id();
                    myuser.HazardIdentification = HazardIdentificationA();
                    myuser.ApplicationUnit = randomValue("08");
                    myuser.Approver = [];//审批人
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            ////提交
            case '/api/TemporaryOperationSafetyLicense/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$TemporaryOperationSafetyLicense.EquipmenFacilities;
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].OperatingUnit = thisuser.OperatingUnit;
                        thisUsers[i].ApplicationNumber = thisuser.ApplicationNumber;
                        thisUsers[i].ApplicationTime = thisuser.ApplicationTime;
                        thisUsers[i].ApplicationDepartment = thisuser.ApplicationDepartment;
                        thisUsers[i].JobStartTime = thisuser.JobStartTime;
                        thisUsers[i].JobEndTime = thisuser.JobEndTime;
                        thisUsers[i].applicant = thisuser.applicant;
                        thisUsers[i].TemporaryElectricityUser = thisuser.TemporaryElectricityUser;
                        thisUsers[i].JobLocation = thisuser.JobLocation;
                        thisUsers[i].TemporaryElectricityUser = thisuser.TemporaryElectricityUser;
                        thisUsers[i].Pick_upPointPosition = thisuser.Pick_upPointPosition;
                        thisUsers[i].WiringElectrician = thisuser.WiringElectrician;
                        thisUsers[i].CurrentJob = thisuser.CurrentJob;
                        thisUsers[i].DisconnectingElectrician = thisuser.DisconnectingElectrician;
                        thisUsers[i].contractor = thisuser.contractor;
                        thisUsers[i].PowerPointOperatingVoltage = thisuser.PowerPointOperatingVoltage;
                        thisUsers[i].WorkContent = thisuser.WorkContent;
                        thisUsers[i].ElectricalEquipmentPower = thisuser.ElectricalEquipmentPower;
                        thisUsers[i].HazardIdentification = thisuser.HazardIdentification;
                        thisUsers[i].BasedDatabaseManagementRequirements = thisuser.BasedDatabaseManagementRequirements;
                        thisUsers[i].Approver = thisuser.Approver;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    //Input 页面需要 去操作List页面的数组 parent
                    parent.$TemporaryOperationSafetyLicense.EquipmenFacilities.push({
                        id: Mock.Random.id(),
                        OperatingUnit: thisuser.OperatingUnit,
                        ApplicationNumber: thisuser.ApplicationNumber,
                        ApplicationDepartment: thisuser.ApplicationDepartment,
                        ApplicationTime: '2019-08-20',
                        JobStartTime: '2019-08-20',
                        JobEndTime: '2019-08-20',
                        applicant: thisuser.applicant,
                        TemporaryElectricityUser: thisuser.TemporaryElectricityUser,
                        Pick_upPointPosition: thisuser.Pick_upPointPosition,
                        JobLocation: thisuser.JobLocation,
                        WiringElectrician: thisuser.WiringElectrician,
                        DisconnectingElectrician: thisuser.DisconnectingElectrician,
                        CurrentJob: randomValue("18"),
                        PowerPointOperatingVoltage: thisuser.PowerPointOperatingVoltage,
                        contractor: thisuser.contractor,
                        WorkContent: thisuser.WorkContent,
                        ElectricalEquipmentPower: thisuser.ElectricalEquipmentPower,
                        HazardIdentification: thisuser.HazardIdentification,
                        BasedDatabaseManagementRequirements: thisuser.BasedDatabaseManagementRequirements,
                        Approver: thisuser.Approver,
                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 30; i++) {
            $TemporaryOperationSafetyLicense.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                ApplicationDepartment: randomValue("14"),//申请部门
                OperatingUnit: randomValue("08"),//作业单位
                ApplicationNumber: Mock.Random.id(),//申请编号
                JobStartTime: Mock.Random.datetime(),//作业起始时间
                JobEndTime: Mock.Random.datetime(),//有效截至时间
                ApplicationTime: Mock.mock('@date()'),//申请时间
                applicant: Mock.Random.cname(),//"申请人",
                TemporaryElectricityUser: Mock.Random.cname(),//临时用电人
                Pick_upPointPosition: randomValue("97"),//取电点位置
                JobLocation: randomValue("97"),//作业地点
                WiringElectrician: Mock.Random.cname() + Mock.mock('@natural()'),//接线电工（包括电工证证号）
                DisconnectingElectrician: Mock.Random.cname() + Mock.mock('@natural()'),//拆线电工（包括电工证证号）
                PowerPointOperatingVoltage: i,//取电点工作电压
                CurrentJob: randomValue("18"),//当前作业
                ElectricalEquipmentPower: i,
                contractor: randomValue("12"),//承包商
                WorkContent: randomValue("n111"), //作业内容
                HazardIdentification: HazardIdentification(),//危害辨识
                BasedDatabaseManagementRequirements: BasedDatabaseManagementRequirements(),//基于数据库管控要求
                Approver: [{ ApproverUnit: randomValue("08"), ApproverConfirmor: randomValue("09") }]//审批人

            }));
        }
    }
}


//气体检测管理
var $GasDetectionManagement = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            //删除
            case '/api/GasDetectionManagement/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $GasDetectionManagement.EquipmenFacilities.length; i++) {
                    temp.push($GasDetectionManagement.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $GasDetectionManagement.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/GasDetectionManagement/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($GasDetectionManagement.EquipmenFacilities.length == 0) {
                        $GasDetectionManagement.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $GasDetectionManagement.EquipmenFacilities.length; i++) {
                        var user = $GasDetectionManagement.EquipmenFacilities[i];
                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
            //获取Input数据
            case '/api/GasDetectionManagement/get': Mock.mock(host + url + '?' + param, type, function (options) {
                var myUsers = parent.$GasDetectionManagement.EquipmenFacilities;
                var myuser;
                for (var i = 0; i < myUsers.length; i++) {
                    var testingcomentList = myUsers[i].TestingcomentList;
                    for (var j = 0; j < testingcomentList.length; j++) {
                        var testingcomentItem = testingcomentList[j]
                        if (testingcomentItem.id == vueApp.id) {
                            myuser = testingcomentItem;
                            break;
                        }
                    }
                    if (myuser)
                        break
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            case '/api/GasDetectionManagement/getAdd': Mock.mock(host + url + '?' + param, type, function (options) {

                var myUsers = parent.$GasDetectionManagement.EquipmenFacilities;
                myuser = {};
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        break;
                    }
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;



            ////提交
            case '/api/GasDetectionManagement/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$GasDetectionManagement.EquipmenFacilities;
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    var obj = thisUsers[i].TestingcomentList;
                    for (var j = 0; j < obj.length; j++) {
                        var testingcomentItem = obj[j];
                        if (thisuser.id == testingcomentItem.id) {
                            testingcomentItem.DetectionTime = thisuser.DetectionTime;
                            testingcomentItem.DetectionPosition = thisuser.DetectionPosition;
                            testingcomentItem.OxygenConcentration = thisuser.OxygenConcentration;
                            testingcomentItem.CombustibleGasConcentrationLEL = thisuser.CombustibleGasConcentrationLEL;
                            testingcomentItem.ToxicGasConcentration = thisuser.ToxicGasConcentration;
                            testingcomentItem.TestConclusion = thisuser.TestConclusion;
                            testingcomentItem.TesterSignature = thisuser.TesterSignature;
                            cz = false;
                            break;
                        }
                    }
                    if (cz == false) {
                        break;
                    }
                }
                if (cz) {
                    for (var i = 0; i < thisUsers.length; i++) {
                        if (thisuser.id == thisUsers[i].id) {
                            var list = {};
                            list.DetectionTime = thisuser.DetectionTime;
                            list.DetectionPosition = thisuser.DetectionPosition;
                            list.OxygenConcentration = thisuser.OxygenConcentration;
                            list.CombustibleGasConcentrationLEL = thisuser.CombustibleGasConcentrationLEL;
                            list.ToxicGasConcentration = thisuser.ToxicGasConcentration;
                            list.TestConclusion = thisuser.TestConclusion;
                            list.TesterSignature = thisuser.TesterSignature;
                            list.id = Mock.Random.id();
                            list.Pid = thisuser.id;
                            thisUsers[i].TestingcomentList.push(list);
                        }
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 30; i++) {
            var Id = Mock.Random.id();
            $GasDetectionManagement.EquipmenFacilities.push(Mock.mock({
                id: Id,
                Number: Mock.Random.id(),
                TerritorialDepartment: randomValue("14"),
                JobManagere: Mock.Random.cname(),
                HotArea: randomValue("97"),
                HotFirePosition: randomValue("n112"),
                TestingRequirements: randomValue("120"),
                TestingcomentList: [{
                    DetectionTime: '2018-05-15', DetectionPosition: randomValue("97"), OxygenConcentration: 50,
                    CombustibleGasConcentrationLEL: 30, ToxicGasConcentration: 50, TestConclusion: randomValue("57"),
                    TesterSignature: Mock.Random.cname(), id: Mock.Random.id(), Pid: Id
                }, {
                    DetectionTime: '2018-05-16', DetectionPosition: randomValue("97"), OxygenConcentration: 20,
                    CombustibleGasConcentrationLEL: 10, ToxicGasConcentration: 30, TestConclusion: randomValue("57"),
                    TesterSignature: Mock.Random.cname(), id: Mock.Random.id(), Pid: Id
                }],
            }));
        }
    }
}


//安全交底和风险告知确认卡
//[by:wanglr]
//[date:2019-06-13]
var $SecurityAndRiskConfirmationCard = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            //删除
            case '/api/SecurityAndRiskConfirmationCard/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $SecurityAndRiskConfirmationCard.EquipmenFacilities.length; i++) {
                    temp.push($SecurityAndRiskConfirmationCard.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $SecurityAndRiskConfirmationCard.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/SecurityAndRiskConfirmationCard/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($SecurityAndRiskConfirmationCard.List.length == 0) {
                        $SecurityAndRiskConfirmationCard.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    var OperatingUnit = p.model.OperatingUnit;
                    var ConfirmationCardNumber = p.model.ConfirmationCardNumber;
                    var ProjectUnitLeader = p.model.ProjectUnitLeader;
                    var JobContent = p.model.JobContent;
                    var JobPerson = p.model.JobPerson;
                    var SignStatus = p.model.SignStatus;


                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $SecurityAndRiskConfirmationCard.List.length; i++) {
                        var user = $SecurityAndRiskConfirmationCard.List[i];
                        if (OperatingUnit && user.OperatingUnit.indexOf(OperatingUnit) == -1)
                            continue;
                        if (ConfirmationCardNumber && user.ConfirmationCardNumber.indexOf(ConfirmationCardNumber) == -1)
                            continue;
                        if (ProjectUnitLeader && user.ProjectUnitLeader.indexOf(ProjectUnitLeader) == -1)
                            continue;
                        if (JobContent && user.JobContent.indexOf(JobContent) == -1)
                            continue;
                        if (JobPerson && user.JobPerson.indexOf(JobPerson) == -1)
                            continue;
                        if (SignStatus && user.SignStatus.indexOf(SignStatus) == -1)
                            continue;
                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
            //获取Input数据
            case '/api/SecurityAndRiskConfirmationCard/get': Mock.mock(host + url + '?' + param, type, function (options) {
                var myUsers = parent.$SecurityAndRiskConfirmationCard.List;
                myuser = {};
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        break;
                    }
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            //提交
            case '/api/SecurityAndRiskConfirmationCard/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$SecurityAndRiskConfirmationCard.List;
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].JobPerson = thisuser.JobPerson;
                        thisUsers[i].SignatureOfLeader = thisuser.SignatureOfLeader;
                        thisUsers[i].SceneLeader = thisuser.SceneLeader;
                        thisUsers[i].RiskIdentificationSafety = thisuser.RiskIdentificationSafety;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    var PersonInChargePidA = randomTreeNode(PersonInChargeTree, '0', true);
                    var PersonInChargeIdA = randomTreeNode(PersonInChargeTree, PersonInChargePidA);
                    parent.$SecurityAndRiskConfirmationCard.List.unshift({
                        id: Mock.Random.id(),
                        OperatingUnit: randomValue("08"),
                        ConfirmationCardNumber: Mock.Random.id(),
                        ProjectUnitLeader: PersonInChargeIdA,
                        JobTime: Mock.Random.datetime(),
                        JobContent: Mock.mock('@cparagraph(1, 1)'),
                        JobPerson: thisuser.JobPerson,
                        SignStatus: Mock.Random.boolean() + '',
                        RiskIdentificationSafety: thisuser.RiskIdentificationSafety,
                        SignatureOfLeader: thisuser.SignatureOfLeader,
                        SceneLeader: thisuser.SceneLeader,
                        WorkshopProjectLeader: Mock.Random.cname(),
                        ScopeAndEnvironment: Mock.mock('@cparagraph(1, 1)'),

                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取穿梭框Input数据
            case '/api/SecurityAndRiskConfirmationCard/getInputTable': Mock.mock(host + url + '?' + param, type, function (options) {
                var myUsers = parent.parent.$SecurityAndRiskConfirmationCard.List;

                console.log('myUsers', myUsers)
                myuser = [];
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                    }
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            case '/api/SecurityAndRiskConfirmationCard/SaveInputTable': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.parent.$SecurityAndRiskConfirmationCard.List;
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].PreventiveMeasures = thisuser.PreventiveMeasures;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    parent.$SecurityAndRiskConfirmationCard.List.unshift({
                        id: Mock.Random.id(),
                        SceneLeader: thisuser.SceneLeader,
                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;


        }
    },
    List: [],
    InitArray: function () {
        for (var i = 0; i < 80; i++) {
            var PersonInChargePidA = randomTreeNode(PersonInChargeTree, '0', true);
            var PersonInChargePidB = randomTreeNode(PersonInChargeTree, '0', true);
            var PersonInChargePidC = randomTreeNode(PersonInChargeTree, '0', true);
            var PersonInChargeIdA = randomTreeNode(PersonInChargeTree, PersonInChargePidA);
            var PersonInChargeIdB = randomTreeNode(PersonInChargeTree, PersonInChargePidB);
            var PersonInChargeIdC = randomTreeNode(PersonInChargeTree, PersonInChargePidC);
            $SecurityAndRiskConfirmationCard.List.push(Mock.mock({
                id: Mock.Random.id(),
                OperatingUnit: randomValue("08"),
                ConfirmationCardNumber: Mock.Random.id(),
                ProjectUnitLeader: PersonInChargeIdA,
                JobTime: Mock.Random.datetime(),
                JobContent: randomValue("n111"), //作业内容
                JobPerson: PersonInChargeIdB,
                SignStatus: Mock.Random.boolean() + '',

                SignatureOfLeader: PersonInChargeIdA,
                SceneLeader: PersonInChargeIdC,

                WorkshopProjectLeader: Mock.Random.cname(),
                ScopeAndEnvironment: Mock.mock('@cparagraph(1, 1)'),
                OperationalRisk: Mock.mock('@cparagraph(1, 1)'),
                PreventiveMeasures: $SecurityAndRiskConfirmationCard.generateData(),
                EmergencyMeasure: Mock.mock('@cparagraph(1, 1)'),
                OtherConsiderations: Mock.mock('@cparagraph(1, 1)'),
                JobTimeBegin: Mock.Random.datetime(),
                JobTimeEnd: Mock.Random.datetime(),
                
                //   RiskIdentificationSafety: RiskStepsBasedDatabase(),//风险识别及安全措施"
                RiskIdentificationSafety: MaintenanceActivitiesDatabase(),//风险识别及安全措施" (只跳检维修作业活动  作业活动等于作业步骤)

                SignatureOfLeaderImg: Mock.Random.image('200x40', '#50B347', '#FFF', 'Sign1'),
                SceneLeaderImg: Mock.Random.image('200x40', '#4A7BF7', '#FFF', 'Sign2')


            }));
        }
    },
    //随机产生
    generateData: function () {
        const data = [];
        for (let i = 1; i <= 15; i++) {
            if (Mock.Random.boolean()) {
                data.push(Mock.mock({
                    key: i,
                    value: '生产作业' + i,
                    remark: Mock.mock('@cword(10)')
                }));
            }
        }
        return data;
    }
}

var WordAreaTree = [
    { "id": 100, "pid": 0, "name": "仓储物流科" },
    { "id": 200, "pid": 0, "name": "动力车间" },
    { "id": 300, "pid": 0, "name": "RT车间" },
    { "id": 400, "pid": 0, "name": "混合动力车间" },
    { "id": 100001, "pid": 100, "name": "原材料罐区" },
    { "id": 200001, "pid": 200, "name": "煤制氢装置" },
    { "id": 300001, "pid": 300, "name": "RT动力装置" },
    { "id": 400001, "pid": 400, "name": "混合动力装置" },
]



var PersonInChargeTree = [
    { "id": 100, "pid": 0, "name": "总经理" },
    { "id": 200, "pid": 0, "name": "生产部" },
    { "id": 300, "pid": 0, "name": "技术科" },
    { "id": 400, "pid": 0, "name": "工程设备科" },
    { "id": 100001, "pid": 100, "name": "黎秀英" },
    { "id": 100002, "pid": 100, "name": "范静" },
    { "id": 200001, "pid": 200, "name": "胡伟" },
    { "id": 200002, "pid": 200, "name": "胡博" },
    { "id": 300001, "pid": 300, "name": "李师伯" },
    { "id": 300002, "pid": 300, "name": "康刚" },
    { "id": 400001, "pid": 400, "name": "郝强" },
]
//生成treeNode随机数
function randomTreeNode(tree, pid, b) {
    var result = '';
    var tempArray = [];
    if (!b) {
        var idArray = [];
        var pidArray = [];
        tree.forEach(function (v, i) {
            if (pid) {
                if (pid == v.pid) {
                    idArray.push(v.id);
                    pidArray.push(v.pid);
                }
            }
            else {
                idArray.push(v.id);
                pidArray.push(v.pid);
            }
        })
        tempArray = idArray.filter(function (v) { return pidArray.indexOf(v) === -1 });
        result = tempArray[Math.floor(Math.random() * tempArray.length)] + '';
    }
    else {
        tree.forEach(function (v, i) {
            if (v.pid + '' == '0') {
                tempArray.push(v.id);
            }
        })
        result = tempArray[Math.floor(Math.random() * tempArray.length)] + '';
    }
    return result;
}
//根据tree数据中的id获取对应的name值
function getTreeValue(tree, id) {
    var value = '';
    tree.forEach(function (v, i) {
        if (v.id + '' == id + '') {
            value = v.name;
            return;
        }
    })
    return value;
}



//管线打开作业安全许可证管理
var $BlindPlatePumpingSafety = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/BlindPlatePumpingSafety/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $BlindPlatePumpingSafety.EquipmenFacilities.length; i++) {
                    temp.push($BlindPlatePumpingSafety.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $BlindPlatePumpingSafety.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/BlindPlatePumpingSafety/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($BlindPlatePumpingSafety.EquipmenFacilities.length == 0) {
                        $BlindPlatePumpingSafety.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var ApplicationNumber = p.model.ApplicationNumber;
                    var OperatingUnit = getDicValue("08", p.model.OperatingUnit);
                    var JobManagere = p.model.JobManagere;
                    var TerritorialDepartment = getDicValue("14", p.model.OperatingName);
                    var applicant = p.model.applicant;
                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $BlindPlatePumpingSafety.EquipmenFacilities.length; i++) {
                        var user = $BlindPlatePumpingSafety.EquipmenFacilities[i];
                        console.log(JobManagere, user.JobManagere)
                        if (ApplicationNumber && user.ApplicationNumber.indexOf(ApplicationNumber) == -1)
                            continue;
                        if (OperatingUnit && user.OperatingUnit.indexOf(OperatingUnit) == -1)
                            continue;
                        if (JobManagere && user.JobManagere.indexOf(JobManagere) == -1)
                            continue;
                        if (applicant && user.applicant.indexOf(applicant) == -1)
                            continue;
                        if (TerritorialDepartment && user.TerritorialDepartment.indexOf(TerritorialDepartment) == -1)
                            continue;
                        user.OperatingUnit = getDicValue("08", user.OperatingUnit) == '' ? user.OperatingUnit : getDicValue("08", user.OperatingUnit);
                        user.TerritorialDepartment = getDicValue("14", user.TerritorialDepartment) == '' ? user.TerritorialDepartment : getDicValue("14", user.TerritorialDepartment);

                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;


            case '/api/BlindPlatePumpingSafety/RelatedTable': Mock.mock(host + url, type,
                function (options) {
                    if ($BlindPlatePumpingSafety.RelatedTable.length == 0) {
                        $BlindPlatePumpingSafety.RelatedTableList();
                    }
                    var list = $BlindPlatePumpingSafety.RelatedTableList();
                    var myUsers = parent.app.Form.RelatedForm;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    for (var i = 0; i < $BlindPlatePumpingSafety.RelatedTable.length; i++) {
                        $BlindPlatePumpingSafety.RelatedTable[i].RelatedFormName = myuser.RelatedFormName;
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var ApplicationNumber = p.model.ApplicationNumber;
                    var applicant = p.model.applicant;
                    var OperatingUnit = getDicValue("08", p.model.OperatingUnit);
                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $BlindPlatePumpingSafety.RelatedTable.length; i++) {
                        var user = $BlindPlatePumpingSafety.RelatedTable[i];
                        if (ApplicationNumber && user.ApplicationNumber.indexOf(ApplicationNumber) == -1)
                            continue;
                        if (OperatingUnit && user.OperatingUnit.indexOf(OperatingUnit) == -1)
                            continue;
                        if (applicant && user.applicant.indexOf(applicant) == -1)
                            continue;
                        //   user.TerritorialDepartment = getDicValue("14", user.TerritorialDepartment) == '' ? user.TerritorialDepartment : getDicValue("14", user.RelatedPeople);
                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;



            ////获取Input数据
            case '/api/BlindPlatePumpingSafety/get': Mock.mock(host + url + '?' + param, type, function (options) {

                var myUsers = parent.$BlindPlatePumpingSafety.EquipmenFacilities;
                myuser = {};
                var bool = true;
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        bool = false
                        break;
                    }
                }
                //新增
                if (bool) {
                    myuser.ApplicationNumber = Mock.Random.id();
                    myuser.ApplicationTime = '2019-08-20';
                    myuser.HazardIdentification = HazardIdentificationA();
                    myuser.RelatedForm = BlindFormAdd();//相关表格
                    myuser.AffectedParties = [];//HSE部安全员
                    myuser.Approver = [],//属地审核人
                        myuser.Guardian = [];//生产部/HSE部审核人
                    myuser.Operator = [];
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            case '/api/BlindPlatePumpingSafety/getRish': Mock.mock(host + url + '?' + param, type, function (options) {
                var id = parent.app.Form.BasedDatabaseManagementRequirements;
                var myuser = {
                    OperationRelatedActivitiesRish: [], ActivityRish: [], OperatingProcedureRish: [], InspectionMaintenanceActivitiesRish: [],
                    EquipmentFacilitiesRish: [], ProcessMediumRish: [], PlaceEnvironmentRish: []
                };
                for (var i = 0; i < id.length; i++) {
                    if (id[i].RiskTypeId == 0) {
                        myuser.OperationRelatedActivitiesRish.push(id[i]);
                        continue;
                    } else if (id[i].RiskTypeId == 1) {
                        myuser.ActivityRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 2) {
                        myuser.OperatingProcedureRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 3) {
                        myuser.InspectionMaintenanceActivitiesRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 4) {
                        myuser.EquipmentFacilitiesRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 5) {
                        myuser.ProcessMediumRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 6) {
                        myuser.PlaceEnvironmentRish.push(id[i]);
                        continue;
                    }
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            ////提交
            case '/api/BlindPlatePumpingSafety/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$BlindPlatePumpingSafety.EquipmenFacilities;
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].OperatingUnit = thisuser.OperatingUnit;
                        thisUsers[i].ApplicationNumber = thisuser.ApplicationNumber;
                        thisUsers[i].ApplicationTime = thisuser.ApplicationTime;
                        thisUsers[i].contractor = thisuser.contractor;
                        thisUsers[i].CurrentJob = thisuser.CurrentJob;
                        thisUsers[i].applicant = thisuser.applicant;
                        thisUsers[i].TerritorialDepartment = thisuser.TerritorialDepartment;
                        thisUsers[i].BlindPlatePluggingOperationJSP = thisuser.BlindPlatePluggingOperationJSP;
                        thisUsers[i].JobStartTime = thisuser.JobStartTime;
                        thisUsers[i].JobEndTime = thisuser.JobEndTime;
                        thisUsers[i].JobType = thisuser.JobType;
                        thisUsers[i].HazardIdentification = thisuser.HazardIdentification;
                        thisUsers[i].BasedDatabaseManagementRequirements = thisuser.BasedDatabaseManagementRequirements;
                        thisUsers[i].Approver = thisuser.Approver;
                        thisUsers[i].RelatedForm = thisuser.RelatedForm;
                        thisUsers[i].BlindPlatePositionMap = thisuser.BlindPlatePositionMap;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    //Input 页面需要 去操作List页面的数组 parent
                    parent.$BlindPlatePumpingSafety.EquipmenFacilities.push({
                        id: Mock.Random.id(),
                        OperatingUnit: thisuser.OperatingUnit,
                        ApplicationNumber: thisuser.ApplicationNumber,
                        ApplicationTime: '2019-08-20',
                        applicant: thisuser.applicant,
                        contractor: thisuser.contractor,
                        CurrentJob: thisuser.CurrentJob,
                        TerritorialDepartment: thisuser.TerritorialDepartment,
                        BlindPlatePluggingOperationJSP: thisuser.BlindPlatePluggingOperationJSP,
                        JobStartTime: '2019-08-20',
                        JobEndTime: '2019-08-20',
                        JobType: thisuser.JobType,
                        HazardIdentification: thisuser.HazardIdentification,
                        BasedDatabaseManagementRequirements: thisuser.BasedDatabaseManagementRequirements,
                        Approver: thisuser.Approver,
                        RelatedForm: thisuser.RelatedForm,
                        BlindPlatePositionMap: thisuser.BlindPlatePositionMap,
                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 30; i++) {
            $BlindPlatePumpingSafety.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                OperatingUnit: randomValue("08"),//作业单位
                applicant: Mock.Random.cname(),
                ApplicationNumber: Mock.Random.id(),//申请编号
                ApplicationTime: Mock.mock('@date()'),//申请时间
                contractor: randomValue("12"),//承包商
                CurrentJob: randomValue("18"),//当前作业
                TerritorialDepartment: randomValue("14"),//属地部门
                BlindPlatePluggingOperationJSP: Mock.mock('@cparagraph(1, 1)'),//附盲板抽堵作业JSA
                JobStartTime: Mock.Random.datetime(),//作业起始时间
                JobEndTime: Mock.Random.datetime(),//有效截至时间
                JobType: randomValue("132"),//作业类型
                HazardIdentification: HazardIdentification(),//危害辨识
                BasedDatabaseManagementRequirements: BasedDatabaseManagementRequirements(),//基于数据库管控要求
                Approver: [{ ApproverUnit: randomValue("08"), ApproverConfirmor: randomValue("09") }],//审批人
                RelatedForm: BlindForm(),//相关表格
                BlindPlatePositionMap: Mock.mock('@natural()') + ".jpg",





            }));
        }
    },
    RelatedTable: [],
    RelatedTableList: function () {
        for (var i = 0; i < 10; i++) {
            $PipelineOpenOperationSafetyLicense.RelatedTable.push(Mock.mock({
                id: Mock.Random.id(),
                RelatedFormName: '',
                RelatedFormNo: Mock.Random.id(),
                RelatedPeople: Mock.Random.cname(),//申请人
                RelatedTime: Mock.mock('@date()') //时间
            }));
        }
    }
}
function BlindForm() {
    var RelatedFormList = [];
    for (var i = 5; i < 6; i++) {
        var RelatedForm = {};
        RelatedForm.id = i;
        RelatedForm.RelatedFormName = getDicValue("93", i);
        RelatedForm.RelatedFormNo = Mock.Random.id();
        RelatedFormList.push(RelatedForm);
    }
    return RelatedFormList;
}
function BlindFormAdd() {
    var RelatedFormList = [];
    for (var i = 5; i < 6; i++) {
        var RelatedForm = {};
        RelatedForm.id = i;
        RelatedForm.RelatedFormName = getDicValue("93", i);
        RelatedFormList.push(RelatedForm);
    }
    return RelatedFormList;
}

////盲板信息管理
var $BlindBoardInformation = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/BlindBoardInformation/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $BlindBoardInformation.EquipmenFacilities.length; i++) {
                    temp.push($BlindBoardInformation.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $BlindBoardInformation.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/BlindBoardInformation/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($BlindBoardInformation.EquipmenFacilities.length == 0) {
                        $BlindBoardInformation.InitArray();
                    }

                    var p = JSON.parse(options.body);
                    //条件

                    var ContractorName = p.model.ContractorName;

                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $BlindBoardInformation.EquipmenFacilities.length; i++) {
                        var user = $BlindBoardInformation.EquipmenFacilities[i];
                        if (ContractorName && user.ContractorName.indexOf(ContractorName) == -1)
                            continue;
                        user.status = getDicValue("51", user.status) == '' ? user.status : getDicValue("51", user.status);
                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
            ////获取Input数据
            case '/api/BlindBoardInformation/get': Mock.mock(host + url + '?' + param, type, function (options) {

                var myUsers = parent.$BlindBoardInformation.EquipmenFacilities;
                myuser = {};
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        break;
                    }
                }
                // myuser.IsConsumables = getDicKey("50", myuser.IsConsumables);
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            ////提交
            case '/api/BlindBoardInformation/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$BlindBoardInformation.EquipmenFacilities;
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].DevicePipeName = thisuser.DevicePipeName;
                        thisUsers[i].Position = thisuser.Position;
                        thisUsers[i].Material = thisuser.Material;
                        thisUsers[i].Specification = thisuser.Specification;
                        thisUsers[i].BlindPlateOperator = thisuser.BlindPlateOperator;
                        thisUsers[i].BlindTime = thisuser.BlindTime;
                        thisUsers[i].BlindPanelGuardian = thisuser.BlindPanelGuardian;
                        thisUsers[i].BlockingPlateOperator = thisuser.BlockingPlateOperator;
                        thisUsers[i].BlockingTime = thisuser.BlockingTime;
                        thisUsers[i].BlockingGuardian = thisuser.BlockingGuardian;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    //Input 页面需要 去操作List页面的数组 parent
                    parent.$BlindBoardInformation.EquipmenFacilities.push({
                        id: thisuser.id,
                        DevicePipeName: thisuser.DevicePipeName,
                        Position: thisuser.Position,
                        Material: thisuser.Material,
                        Specification: thisuser.Specification,
                        BlindPlateOperator: thisuser.BlindPlateOperator,
                        BlindTime: thisuser.BlindTime,
                        BlindPanelGuardian: thisuser.BlindPanelGuardian,
                        BlockingPlateOperator: thisuser.BlockingPlateOperator,
                        BlockingTime: thisuser.BlockingTime,
                        BlockingGuardian: thisuser.BlockingGuardian,
                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 80; i++) {
            $BlindBoardInformation.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                DevicePipeName: randomValue("n113"),//"设备管道名称",
                Position: Mock.Random.cname(),//"位置",
                Material: Mock.Random.cname(),//"材料",
                Specification: Mock.Random.cname(),//"规格",
                BlindPlateOperator: Mock.Random.cname(),// "抽盲板作业人",
                BlindTime: Mock.Random.datetime(),//"抽盲板时间",
                BlindPanelGuardian: Mock.Random.cname(),// "抽盲板监护人",
                BlockingPlateOperator: Mock.Random.cname(),// "堵盲板作业人",
                BlockingTime: Mock.Random.datetime(),// "堵盲板时间",
                BlockingGuardian: Mock.Random.cname(),// "堵盲板监护人",
            }));
        }
    }
}


//盲板信息管理
var $IsolationBlindTable = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            //删除
            case '/api/IsolationBlindTable/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $IsolationBlindTable.EquipmenFacilities.length; i++) {
                    temp.push($IsolationBlindTable.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $IsolationBlindTable.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/IsolationBlindTable/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($IsolationBlindTable.EquipmenFacilities.length == 0) {
                        $IsolationBlindTable.InitArray();
                    }
                    var p = JSON.parse(options.body);

                    var RecordNumber = p.model.RecordNumber;
                    var WorkshopType = getDicValue("133", p.model.WorkshopType);
                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];


                    for (var i = 0; i < $IsolationBlindTable.EquipmenFacilities.length; i++) {
                        var user = $IsolationBlindTable.EquipmenFacilities[i];
                        if (RecordNumber && user.RecordNumber.indexOf(RecordNumber) == -1)
                            continue;
                        if (WorkshopType && user.WorkshopType.indexOf(WorkshopType) == -1)
                            continue;
                        user.WorkshopType = getDicValue("133", user.WorkshopType) == '' ? user.WorkshopType : getDicValue("133", user.WorkshopType);

                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
            //获取Input数据
            case '/api/IsolationBlindTable/get': Mock.mock(host + url + '?' + param, type, function (options) {

                var myUsers = parent.$IsolationBlindTable.EquipmenFacilities;
                myuser = {};
                var bool = true;
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        bool = false;
                        break;
                    }
                }
                if (bool) {
                    myuser.RecordNumber = Mock.Random.id();
                    myuser.IsolationBlindList = [];
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            case '/api/IsolationBlindTable/getItem': Mock.mock(host + url + '?' + param, type, function (options) {
                var myUsers = parent.parent.$IsolationBlindTable.EquipmenFacilities;


                myuser = {};
                for (var i = 0; i < myUsers.length; i++) {
                    var testingcomentList = myUsers[i].IsolationBlindList;
                    for (var j = 0; j < testingcomentList.length; j++) {
                        var testingcomentItem = testingcomentList[j]

                        if (testingcomentItem.id == vueApp.id) {
                            myuser = testingcomentItem;
                            break;
                        }
                    }
                    if (myuser)
                        break
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            //提交
            case '/api/IsolationBlindTable/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$IsolationBlindTable.EquipmenFacilities;
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].WorkshopType = thisuser.WorkshopType;
                        thisUsers[i].RecordNumber = thisuser.RecordNumber;
                        thisUsers[i].ReportStartTime = thisuser.ReportStartTime;
                        thisUsers[i].IsolationBlindList = thisuser.IsolationBlindList;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    //Input 页面需要 去操作List页面的数组 parent
                    parent.$IsolationBlindTable.EquipmenFacilities.push({
                        id: thisuser.id,
                        WorkshopType: thisuser.WorkshopType,
                        RecordNumber: thisuser.RecordNumber,
                        ReportStartTime: '2019-05-20',
                        IsolationBlindList: thisuser.IsolationBlindList,
                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 30; i++) {
            var Id = Mock.Random.id();
            $IsolationBlindTable.EquipmenFacilities.push(Mock.mock({
                id: Id,
                WorkshopType: randomValue("133"),
                RecordNumber: Mock.Random.id(),
                ReportStartTime: Mock.Random.datetime(),
                IsolationBlindList: [{
                    Position: '车间东南', Numbering: Mock.mock('@natural()'), InstallationTime: Mock.Random.datetime(),
                    InstallationManager: Mock.Random.cname(), ExtractionTime: Mock.Random.datetime(),
                    ExtractPersonCharge: Mock.Random.cname(), id: Mock.Random.id(), Pid: Id
                }, {
                    Position: '车间东南', Numbering: Mock.mock('@natural()'), InstallationTime: Mock.Random.datetime(),
                    InstallationManager: Mock.Random.cname(), ExtractionTime: Mock.Random.datetime(),
                    ExtractPersonCharge: Mock.Random.cname(), id: Mock.Random.id(), Pid: Id
                }],
            }));
        }
    }
}


//受限空间作业安全许可证管理
var $ConfinedSpaceWorkSafety = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/ConfinedSpaceWorkSafety/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $ConfinedSpaceWorkSafety.EquipmenFacilities.length; i++) {
                    temp.push($ConfinedSpaceWorkSafety.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $ConfinedSpaceWorkSafety.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/ConfinedSpaceWorkSafety/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($ConfinedSpaceWorkSafety.EquipmenFacilities.length == 0) {
                        $ConfinedSpaceWorkSafety.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var ApplicationNumber = p.model.ApplicationNumber;
                    //    var OperatingUnit = getDicValue("08", p.model.OperatingUnit);
                    var applicant = p.model.applicant;
                    var TerritorialDepartment = getDicValue("14", p.model.TerritorialDepartment);

                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $ConfinedSpaceWorkSafety.EquipmenFacilities.length; i++) {
                        var user = $ConfinedSpaceWorkSafety.EquipmenFacilities[i];
                        console.log(TerritorialDepartment, user.TerritorialDepartment)
                        if (ApplicationNumber && user.ApplicationNumber.indexOf(ApplicationNumber) == -1)
                            continue;
                        if (applicant && user.applicant.indexOf(applicant) == -1)
                            continue;
                        if (TerritorialDepartment && user.TerritorialDepartment.indexOf(TerritorialDepartment) == -1)
                            continue;
                        user.OperatingUnit = getDicValue("08", user.OperatingUnit) == '' ? user.OperatingUnit : getDicValue("08", user.OperatingUnit);
                        user.TerritorialDepartment = getDicValue("14", user.TerritorialDepartment) == '' ? user.TerritorialDepartment : getDicValue("14", user.TerritorialDepartment);

                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;


            case '/api/ConfinedSpaceWorkSafety/RelatedTable': Mock.mock(host + url, type,
                function (options) {
                    if ($ConfinedSpaceWorkSafety.RelatedTable.length == 0) {
                        $ConfinedSpaceWorkSafety.RelatedTableList();
                    }
                    var list = $ConfinedSpaceWorkSafety.RelatedTableList();
                    var myUsers = parent.app.Form.RelatedForm;
                    myuser = {};
                    for (var i = 0; i < myUsers.length; i++) {
                        if (myUsers[i].id == vueApp.id) {
                            myuser = myUsers[i];
                            break;
                        }
                    }
                    for (var i = 0; i < $ConfinedSpaceWorkSafety.RelatedTable.length; i++) {
                        $ConfinedSpaceWorkSafety.RelatedTable[i].RelatedFormName = myuser.RelatedFormName;
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var RelatedFormNo = p.model.RelatedFormNo;
                    var RelatedPeople = p.model.RelatedPeople;
                    var TerritorialDepartment = getDicValue("14", p.model.TerritorialDepartment);
                    //分页
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $ConfinedSpaceWorkSafety.RelatedTable.length; i++) {
                        var user = $ConfinedSpaceWorkSafety.RelatedTable[i];
                        if (RelatedFormNo && user.RelatedFormNo.indexOf(RelatedFormNo) == -1)
                            continue;
                        if (RelatedPeople && user.RelatedPeople.indexOf(RelatedPeople) == -1)
                            continue;
                        if (TerritorialDepartment && user.TerritorialDepartment.indexOf(TerritorialDepartment) == -1)
                            continue;
                        user.TerritorialDepartment = getDicValue("14", user.TerritorialDepartment) == '' ? user.TerritorialDepartment : getDicValue("14", user.RelatedPeople);
                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
            case '/api/ConfinedSpaceWorkSafety/getRestrictedPerson': Mock.mock(host + url + '?' + param, type, function (options) {
                var myUsers = parent.$ConfinedSpaceWorkSafety.EquipmenFacilities;
                myuser = {};
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        break;
                    }
                }
                myuser.RestrictedPerson.Name = getDicValue("09", myuser.RestrictedPerson.Name) == '' ? myuser.RestrictedPerson.Name : getDicValue("09", myuser.RestrictedPerson.Name);
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            case '/api/ConfinedSpaceWorkSafety/getRestrictedObject': Mock.mock(host + url + '?' + param, type, function (options) {
                var myUsers = parent.$ConfinedSpaceWorkSafety.EquipmenFacilities;
                myuser = {};
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        break;
                    }
                }
                //    myuser.RestrictedPerson.Name = getDicValue("09", myuser.RestrictedPerson.Name) == '' ? myuser.RestrictedPerson.Name : getDicValue("09", myuser.RestrictedPerson.Name);
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;

            ////获取Input数据
            case '/api/ConfinedSpaceWorkSafety/get': Mock.mock(host + url + '?' + param, type, function (options) {

                var myUsers = parent.$ConfinedSpaceWorkSafety.EquipmenFacilities;
                myuser = {};
                var bool = true;
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        bool = false
                        break;
                    }
                }
                //新增
                if (bool) {
                    myuser.ApplicationNumber = Mock.Random.id();
                    myuser.ApplicationTime = '2019-08-20';
                    myuser.HazardIdentification = HazardIdentificationA();
                    myuser.RelatedForm = ConfinedSpaceAdd();//相关表格
                    myuser.AffectedParties = [];//HSE部安全员
                    myuser.Approver = [],//属地审核人
                    myuser.Guardian = [];//生产部/HSE部审核人
                    myuser.Operator = [];
                    myuser.InvolvingOtherSpecialOperations = [];
                    myuser.JobType = [];
                    myuser.PossibleRisk = [];
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            case '/api/ConfinedSpaceWorkSafety/getRish': Mock.mock(host + url + '?' + param, type, function (options) {
                var id = parent.app.Form.BasedDatabaseManagementRequirements;
                var myuser = {
                    OperationRelatedActivitiesRish: [], ActivityRish: [], OperatingProcedureRish: [], InspectionMaintenanceActivitiesRish: [],
                    EquipmentFacilitiesRish: [], ProcessMediumRish: [], PlaceEnvironmentRish: []
                };
                for (var i = 0; i < id.length; i++) {
                    if (id[i].RiskTypeId == 0) {
                        myuser.OperationRelatedActivitiesRish.push(id[i]);
                        continue;
                    } else if (id[i].RiskTypeId == 1) {
                        myuser.ActivityRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 2) {
                        myuser.OperatingProcedureRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 3) {
                        myuser.InspectionMaintenanceActivitiesRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 4) {
                        myuser.EquipmentFacilitiesRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 5) {
                        myuser.ProcessMediumRish.push(id[i]);
                        continue;
                    }
                    else if (id[i].RiskTypeId == 6) {
                        myuser.PlaceEnvironmentRish.push(id[i]);
                        continue;
                    }
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;

            case '/api/ConfinedSpaceWorkSafety/getItem': Mock.mock(host + url + '?' + param, type, function (options) {
                var myUsers = parent.parent.$ConfinedSpaceWorkSafety.EquipmenFacilities;
                console.log(vueApp.id);
                myuser = {};
                for (var i = 0; i < myUsers.length; i++) {
                    var testingcomentList = myUsers[i].RestrictedPerson;
                    for (var j = 0; j < testingcomentList.length; j++) {
                        var testingcomentItem = testingcomentList[j]

                        if (testingcomentItem.id == vueApp.id) {
                            myuser = testingcomentItem;
                            break;
                        }
                    }
                    if (myuser)
                        break
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            case '/api/ConfinedSpaceWorkSafety/getRestrictedObjectItem': Mock.mock(host + url + '?' + param, type, function (options) {
                var myUsers = parent.parent.$ConfinedSpaceWorkSafety.EquipmenFacilities;
                console.log(vueApp.id);
                myuser = {};
                for (var i = 0; i < myUsers.length; i++) {
                    var testingcomentList = myUsers[i].RestrictedObject;
                    for (var j = 0; j < testingcomentList.length; j++) {
                        var testingcomentItem = testingcomentList[j]

                        if (testingcomentItem.id == vueApp.id) {
                            myuser = testingcomentItem;
                            break;
                        }
                    }
                    if (myuser)
                        break
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            ////提交
            case '/api/ConfinedSpaceWorkSafety/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$ConfinedSpaceWorkSafety.EquipmenFacilities;
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].OperatingUnit = thisuser.OperatingUnit;
                        thisUsers[i].ApplicationNumber = thisuser.ApplicationNumber;
                        thisUsers[i].ApplicationTime = thisuser.ApplicationTime;
                        thisUsers[i].contractor = thisuser.contractor;
                        thisUsers[i].CurrentJob = thisuser.CurrentJob;
                        thisUsers[i].applicant = thisuser.applicant;
                        thisUsers[i].TerritorialDepartment = thisuser.TerritorialDepartment;
                        thisUsers[i].WorkingArea = thisuser.WorkingArea;
                        thisUsers[i].JobStartTime = thisuser.JobStartTime;
                        thisUsers[i].JobEndTime = thisuser.JobEndTime;
                        thisUsers[i].JobType = thisuser.JobType;
                        thisUsers[i].JobLocation = thisuser.JobLocation;
                        thisUsers[i].RestrictedSpaceName = thisuser.RestrictedSpaceName;
                        thisUsers[i].WorkContent = thisuser.WorkContent;
                        thisUsers[i].InvolvingOtherSpecialOperations = thisuser.InvolvingOtherSpecialOperations;
                        thisUsers[i].IsSafeWorkProgram = thisuser.IsSafeWorkProgram;
                        thisUsers[i].IsDrawing = thisuser.IsDrawing;
                        thisUsers[i].IsWhetherEmergencyPlan = thisuser.IsWhetherEmergencyPlan;
                        thisUsers[i].GasDetector = thisuser.GasDetector;
                        thisUsers[i].TestingRequirements = thisuser.TestingRequirements;
                        thisUsers[i].PossibleRisk = thisuser.PossibleRisk;
                        thisUsers[i].AffectedParties = thisuser.AffectedParties;
                        thisUsers[i].HazardIdentification = thisuser.HazardIdentification;
                        thisUsers[i].BasedDatabaseManagementRequirements = thisuser.BasedDatabaseManagementRequirements;
                        thisUsers[i].Approver = thisuser.Approver;
                        thisUsers[i].RelatedForm = thisuser.RelatedForm;
                        thisUsers[i].Guardian = thisuser.Guardian;
                        thisUsers[i].Operator = thisuser.Operator;
                        thisUsers[i].RestrictedPerson = thisuser.RestrictedPerson;
                        thisUsers[i].RestrictedObject = thisuser.RestrictedObject;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    //Input 页面需要 去操作List页面的数组 parent
                    parent.$ConfinedSpaceWorkSafety.EquipmenFacilities.push({
                        id: Mock.Random.id(),
                        OperatingUnit: thisuser.OperatingUnit,
                        ApplicationNumber: thisuser.ApplicationNumber,
                        ApplicationTime: '2019-08-20',
                        applicant: thisuser.applicant,
                        contractor: thisuser.contractor,
                        CurrentJob: thisuser.CurrentJob,
                        TerritorialDepartment: thisuser.TerritorialDepartment,
                        WorkingArea: thisuser.WorkingArea,
                        JobStartTime: '2019-08-20',
                        JobEndTime: '2019-08-20',
                        JobLocation: thisuser.JobLocation,
                        RestrictedSpaceName: thisuser.RestrictedSpaceName,
                        WorkContent: thisuser.WorkContent,
                        InvolvingOtherSpecialOperations: thisuser.InvolvingOtherSpecialOperations,
                        IsSafeWorkProgram: thisuser.IsSafeWorkProgram,
                        IsDrawing: thisuser.IsDrawing,
                        IsWhetherEmergencyPlan: thisuser.IsWhetherEmergencyPlan,
                        GasDetector: thisuser.GasDetector,
                        TestingRequirements: thisuser.TestingRequirements,
                        JobType: thisuser.JobType,
                        PossibleRisk: thisuser.PossibleRisk,
                        HazardIdentification: thisuser.HazardIdentification,
                        BasedDatabaseManagementRequirements: thisuser.BasedDatabaseManagementRequirements,
                        AffectedParties: thisuser.AffectedParties,
                        Approver: thisuser.Approver,
                        Guardian: thisuser.Guardian,
                        Operator: thisuser.Operator,
                        RelatedForm: thisuser.RelatedForm,
                        RestrictedPerson: thisuser.RestrictedPerson,
                        RestrictedObject: thisuser.RestrictedObject,
                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 30; i++) {
            var Id = Mock.Random.id();
            $ConfinedSpaceWorkSafety.EquipmenFacilities.push(Mock.mock({
                id: Id,
                OperatingUnit: randomValue("08"),//作业单位
                applicant: Mock.Random.cname(),
                ApplicationNumber: Mock.Random.id(),//申请编号
                ApplicationTime: Mock.mock('@date()'),//申请时间
                contractor: randomValue("12"),//承包商
                CurrentJob: randomValue("18"),//当前作业
                TerritorialDepartment: randomValue("14"),//属地部门
                WorkingArea: randomValue("97"),//作业区域
                JobLocation: randomValue("97"),//作业位置
                RestrictedSpaceName: Mock.mock('@cparagraph(1, 1)'),//受限空间内原危险介质名称
                JobStartTime: Mock.Random.datetime(),//作业起始时间
                JobEndTime: Mock.Random.datetime(),//有效截至时间
                WorkContent: randomValue("n111"), //作业内容描述
                InvolvingOtherSpecialOperations: randomValue("134", 3),//涉及其他特殊作业
                IsSafeWorkProgram: randomValue("50"),//是否附安全作业方案
                IsDrawing: randomValue("50"),//是否附图纸
                IsWhetherEmergencyPlan: randomValue("50"),//是否附应急预案
                GasDetector: randomValue("09"),//气体检测人
                TestingRequirements: randomValue("120"),//检测要求(检测频次)
                JobType: randomValue("121", 3),//作业类型
                PossibleRisk: randomValue("135", 3),//可能的风险
                HazardIdentification: HazardIdentification(),//危害辨识
                BasedDatabaseManagementRequirements: BasedDatabaseManagementRequirements(),//基于数据库管控要求
                AffectedParties: [{ unit: randomValue('08'), unitPeople: randomValue('09') }],//受影响相关放
                Approver: [{ ApproverUnit: randomValue("08"), ApproverConfirmor: randomValue("09") }],//审批人
                Guardian: [{ GuardianUnit: randomValue("08"), GuardianConfirmor: randomValue("09") }],//监护人
                Operator: [{ OperatorUnit: randomValue("08"), OperatorConfirmor: randomValue("09") }],//作业人
                RelatedForm: ConfinedSpaceForm(),//相关表格
                RestrictedPerson: [{
                    Name: randomValue("09"), IntoRestrictedSpaceTime: Mock.Random.datetime(), OutSpaceTime: Mock.Random.datetime(),
                    ConfirmationSignature: Mock.Random.cname(), SignatureTime: Mock.Random.datetime(), Pid: Id, id: Mock.Random.id()
                }],
                RestrictedObject: [{
                    GoodsName: 'aa', Quantity: i, IntoRestrictedSpaceTime: Mock.Random.datetime(), OutSpaceTime: Mock.Random.datetime(),
                    ConfirmationSignature: Mock.Random.cname(), SignatureTime: Mock.Random.datetime(), Pid: Id, id: Mock.Random.id()
                }],
            }));
        }
    },
    RelatedTable: [],
    RelatedTableList: function () {
        for (var i = 0; i < 10; i++) {
            $ConfinedSpaceWorkSafety.RelatedTable.push(Mock.mock({
                id: Mock.Random.id(),
                RelatedFormName: '',
                RelatedFormNo: Mock.Random.id(),
                RelatedPeople: Mock.Random.cname(),//申请人
                RelatedTime: Mock.mock('@date()') //时间
            }));
        }
    }
}
function ConfinedSpaceForm() {
    var RelatedFormList = [];
    for (var i = 6; i < 7; i++) {
        var RelatedForm = {};
        RelatedForm.id = i;
        RelatedForm.RelatedFormName = getDicValue("93", i);
        RelatedForm.RelatedFormNo = Mock.Random.id();
        RelatedFormList.push(RelatedForm);
    }
    return RelatedFormList;
}
function ConfinedSpaceAdd() {
    var RelatedFormList = [];
    for (var i = 6; i < 7; i++) {
        var RelatedForm = {};
        RelatedForm.id = i;
        RelatedForm.RelatedFormName = getDicValue("93", i);
        RelatedFormList.push(RelatedForm);
    }
    return RelatedFormList;
}


//特种作业安全教育培训记录
var $SpecialOperationSafetyEducation = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/SpecialOperationSafetyEducation/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $SpecialOperationSafetyEducation.EquipmenFacilities.length; i++) {
                    temp.push($SpecialOperationSafetyEducation.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $SpecialOperationSafetyEducation.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/SpecialOperationSafetyEducation/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($SpecialOperationSafetyEducation.EquipmenFacilities.length == 0) {
                        $SpecialOperationSafetyEducation.InitArray();
                    }

                    var p = JSON.parse(options.body);
                    //条件

                    var RecordNumber = p.model.RecordNumber;
                    //分页
                    var Educator = p.model.Educator;
                    var EducatedPerson = p.model.EducatedPerson;
                    var SignatureStatus = getDicValue("137", p.model.SignatureStatus);
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $SpecialOperationSafetyEducation.EquipmenFacilities.length; i++) {
                        var user = $SpecialOperationSafetyEducation.EquipmenFacilities[i];
                        if (RecordNumber && user.RecordNumber.indexOf(RecordNumber) == -1)
                            continue;
                        if (Educator && user.Educator.indexOf(Educator) == -1)
                            continue;
                        if (EducatedPerson && user.EducatedPerson.indexOf(EducatedPerson) == -1)
                            continue;
                        user.SignatureStatus = getDicValue("137", user.SignatureStatus) == '' ? user.SignatureStatus : getDicValue("137", user.SignatureStatus);
                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
            ////获取Input数据
            case '/api/SpecialOperationSafetyEducation/get': Mock.mock(host + url + '?' + param, type, function (options) {

                var myUsers = parent.$SpecialOperationSafetyEducation.EquipmenFacilities;
                myuser = {};
                var bool = true;
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        bool = false
                        break;
                    }
                }
                if (bool) {
                    myuser.RecordNumber = Mock.Random.id();
                    myuser.MainContentSafetyEducation = MainContentSafetyEducation();
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            ////提交
            case '/api/SpecialOperationSafetyEducation/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$SpecialOperationSafetyEducation.EquipmenFacilities;
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].EducationStartTime = thisuser.EducationStartTime;
                        thisUsers[i].RecordNumber = thisuser.RecordNumber;
                        thisUsers[i].Educator = thisuser.Educator;
                        thisUsers[i].EducatedPerson = thisuser.EducatedPerson;
                        thisUsers[i].MainContentSafetyEducation = thisuser.MainContentSafetyEducation;
                        thisUsers[i].SignatureStatus = thisuser.SignatureStatus;
                        thisUsers[i].EducatedPersonDept = thisuser.EducatedPersonDept;
                        thisUsers[i].EducatorDept = thisuser.EducatorDept;
                        thisUsers[i].EducationEndTime = thisuser.EducationEndTime;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    var PersonInChargePidA = randomTreeNode(PersonInChargeTree, '0', true);
                    var PersonInChargeIdA = randomTreeNode(PersonInChargeTree, PersonInChargePidA);
                    //Input 页面需要 去操作List页面的数组 parent
                    parent.$SpecialOperationSafetyEducation.EquipmenFacilities.push({
                        id: thisuser.id,
                        EducationStartTime: thisuser.EducationStartTime,
                        RecordNumber: thisuser.RecordNumber,
                        Educator: PersonInChargeIdA,
                        EducatedPerson: PersonInChargeIdA,
                        MainContentSafetyEducation: thisuser.MainContentSafetyEducation,
                        SignatureStatus: thisuser.SignatureStatus,
                        EducationEndTime: thisuser.EducationEndTime,
                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {


        for (var i = 0; i < 80; i++) {
            var PersonInChargePidA = randomTreeNode(PersonInChargeTree, '0', true);
            var PersonInChargeIdA = randomTreeNode(PersonInChargeTree, PersonInChargePidA);
            $SpecialOperationSafetyEducation.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                EducationStartTime: Mock.mock('@date()'),
                EducationEndTime: Mock.mock('@date()'),
                RecordNumber: Mock.Random.id(),

                Educator: PersonInChargeIdA,
                EducatedPerson: PersonInChargeIdA,

                MainContentSafetyEducation: MainContentSafetyEducation(),
                SignatureStatus: randomValue("137"),
            }));
        }
    }
}

function MainContentSafetyEducation() {
    var MainContentSafetyEducationList = [];
    for (var i = 0; i < 8; i++) {
        var MainContentSafetyEducation = {};
        MainContentSafetyEducation.id = i+1;
        MainContentSafetyEducation.SafetyMeasures = getDicValue("136", i);
        MainContentSafetyEducationList.push(MainContentSafetyEducation);
    }
    return MainContentSafetyEducationList;
}


////作业许可证取消
var $JobPermitCancellation = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/JobPermitCancellation/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $JobPermitCancellation.EquipmenFacilities.length; i++) {
                    temp.push($JobPermitCancellation.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $JobPermitCancellation.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/JobPermitCancellation/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($JobPermitCancellation.EquipmenFacilities.length == 0) {
                        $JobPermitCancellation.InitArray();
                    }

                    var p = JSON.parse(options.body);
                    //条件

                    var JobTicketNumber = p.model.JobTicketNumber;

                    var status = getDicValue("51", p.model.status);
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $JobPermitCancellation.EquipmenFacilities.length; i++) {
                        var user = $JobPermitCancellation.EquipmenFacilities[i];
                        if (JobTicketNumber && user.JobTicketNumber.indexOf(JobTicketNumber) == -1)
                            continue;
                        if (status && user.status.indexOf(status) == -1)
                            continue;

                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
            ////获取Input数据
            case '/api/JobPermitCancellation/get': Mock.mock(host + url + '?' + param, type, function (options) {

                var myUsers = parent.$JobPermitCancellation.EquipmenFacilities;
                myuser = {};
                var bool = true;
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        bool = false
                        break;
                    }
                }
                if (bool) {
                    myuser.JobTicketNumber = Mock.Random.id();
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            ////提交
            case '/api/JobPermitCancellation/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$JobPermitCancellation.EquipmenFacilities;
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].CancelApplicationTime = thisuser.CancelApplicationTime;
                        thisUsers[i].JobTicketNumber = thisuser.JobTicketNumber;
                        thisUsers[i].ReasonCancellation = thisuser.ReasonCancellation;
                        thisUsers[i].JobManager = thisuser.JobManager;
                        thisUsers[i].Applicant = thisuser.Applicant;
                        thisUsers[i].ProcessingTime = thisuser.ProcessingTime;
                        thisUsers[i].status = thisuser.status;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    //Input 页面需要 去操作List页面的数组 parent
                    parent.$JobPermitCancellation.EquipmenFacilities.push({
                        id: thisuser.id,
                        CancelApplicationTime: thisuser.CancelApplicationTime,
                        JobTicketNumber: thisuser.JobTicketNumber,
                        ReasonCancellation: thisuser.ReasonCancellation,
                        JobManager: randomValue("09"),
                        Applicant: randomValue("09"),
                        ProcessingTime: '2018-08-26',
                        status: thisuser.status,
                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 80; i++) {
            $JobPermitCancellation.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                CancelApplicationTime: Mock.mock('@date()'),
                JobTicketNumber: Mock.Random.id(),
                ReasonCancellation:  randomValue("n116"),//取消原因
                JobManager: randomValue("09"),
                Applicant: randomValue("09"),
                ProcessingTime: Mock.mock('@date()'),
                status: randomValue("51"),
            }));
        }
    }
}


//上签挂锁
var $LockedCheck = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/LockedCheck/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $LockedCheck.EquipmenFacilities.length; i++) {
                    temp.push($LockedCheck.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $LockedCheck.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/LockedCheck/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($LockedCheck.EquipmenFacilities.length == 0) {
                        $LockedCheck.InitArray();
                    }

                    var p = JSON.parse(options.body);
                    //条件

                    var RecordNumber = p.model.RecordNumber;
                    //分页
                    var TerritorialDepartment = getDicValue("14", p.model.TerritorialDepartment);
                    var IdentifyPeople = (p.model.IdentifyPeople);
                    var Approver = (p.model.Approver);
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $LockedCheck.EquipmenFacilities.length; i++) {
                        var user = $LockedCheck.EquipmenFacilities[i];
                        if (TerritorialDepartment && user.TerritorialDepartment.indexOf(TerritorialDepartment) == -1)
                            continue;
                        if (Approver && user.Approver.indexOf(Approver) == -1)
                            continue;

                        if (IdentifyPeople && user.IdentifyPeople.indexOf(IdentifyPeople) == -1)
                            continue;
                        user.TerritorialDepartment = getDicValue("14", user.TerritorialDepartment) == '' ? user.TerritorialDepartment : getDicValue("14", user.TerritorialDepartment);
                        //user.IdentifyPeople = (getTreeValue(PersonInChargeTree, user.IdentifyPeople))
                        //user.Approver = (getTreeValue(PersonInChargeTree, user.Approver))
                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
            ////获取Input数据
            case '/api/LockedCheck/get': Mock.mock(host + url + '?' + param, type, function (options) {

                var myUsers = parent.$LockedCheck.EquipmenFacilities;
                myuser = {};
                var bool = true;
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        bool = false
                        break;
                    }
                }
                if (bool) {
                    myuser.SignNumber = Mock.Random.id();
                    myuser.ReportTime = Mock.mock('@date()');
                    myuser.HazardousList = [];
                }
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            ////提交
            case '/api/LockedCheck/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$LockedCheck.EquipmenFacilities;
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].TerritorialDepartment = thisuser.TerritorialDepartment;
                        thisUsers[i].WorkingArea = thisuser.WorkingArea;
                        thisUsers[i].OperatingUnit = thisuser.OperatingUnit;
                        thisUsers[i].SignNumber = thisuser.SignNumber;
                        thisUsers[i].ReportTime = thisuser.ReportTime;
                        thisUsers[i].WorkingTime = thisuser.WorkingTime;
                        thisUsers[i].WorkContent = thisuser.WorkContent;
                        thisUsers[i].IsolationSystem = thisuser.IsolationSystem;
                        thisUsers[i].HazardousList = thisuser.HazardousList;
                        thisUsers[i].Approver = thisuser.Approver;
                        thisUsers[i].IdentifyPeople = thisuser.IdentifyPeople;
                        thisUsers[i].SignatureStatus = thisuser.SignatureStatus;

                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    //Input 页面需要 去操作List页面的数组 parent
                    var PersonInChargePidA = randomTreeNode(PersonInChargeTree, '0', true);
                    var PersonInChargeIdA = randomTreeNode(PersonInChargeTree, PersonInChargePidA);
                    parent.$LockedCheck.EquipmenFacilities.push({
                        id: Mock.Random.id(),
                        TerritorialDepartment: thisuser.TerritorialDepartment,
                        WorkingArea: thisuser.WorkingArea,
                        OperatingUnit: thisuser.OperatingUnit,
                        SignNumber: thisuser.SignNumber,
                        ReportTime: thisuser.ReportTime,
                        WorkingTime: thisuser.WorkingTime,
                        WorkContent: thisuser.WorkContent,
                        IsolationSystem: thisuser.IsolationSystem,
                        HazardousList: HazardousList,
                        Approver: PersonInChargeIdA,
                        IdentifyPeople: PersonInChargeIdA,
                        SignatureStatus: SignatureStatus,
                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 3; i++) {
            var PersonInChargePidA = randomTreeNode(PersonInChargeTree, '0', true);
            var PersonInChargeIdA = randomTreeNode(PersonInChargeTree, PersonInChargePidA);
            $LockedCheck.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                TerritorialDepartment: randomValue("14"),//属地部门
                WorkingArea: randomValue("97"),//作业区域
                OperatingUnit: randomValue("08"),//作业单位
                SignNumber: Mock.Random.id(),//申请编号

                ReportTime: Mock.mock('@date()'),//申请时间
                WorkingTime: Mock.mock('@date()'),
                WorkContent: Mock.mock('@cparagraph(1, 1)'), //
                IsolationSystem: Mock.mock('@cparagraph(1, 1)'),
                HazardousList: [{
                    HazardousEnergy: Mock.mock('@cparagraph(1, 1)'), Harm: Mock.mock('@cparagraph(1, 1)'),
                    IsolationMethod: randomValue("138"), IsolationPoint: Mock.mock('@cparagraph(1, 1)'),
                    LockedSigner: randomValue("09")
                }],
                IdentifyPeople: PersonInChargeIdA,
                Approver: PersonInChargeIdA,
                SignatureStatus: randomValue("137"),//作业区域
            }));
        }
    }
}



//
var $ConfinedSpacemanagement = {
    DealUrl: function (vueApp, url, type, param) {
        var my = vueApp;
        switch (url) {
            ////删除
            case '/api/ConfinedSpacemanagement/DeleteMuti': Mock.mock(host + url, type, function (options) {
                var delIDs = options.body;
                var temp = [];
                for (var i = 0; i < $ConfinedSpacemanagement.EquipmenFacilities.length; i++) {
                    temp.push($ConfinedSpacemanagement.EquipmenFacilities[i]);
                }
                for (var i = 0; i < temp.length; i++) {
                    if (delIDs.includes(temp[i].id)) {
                        $ConfinedSpacemanagement.EquipmenFacilities.splice(temp[i], 1);
                    }
                }
                return { result: "Success", message: null, data: null };
            }); break;
            //获取List数据
            case '/api/ConfinedSpacemanagement/GetList': Mock.mock(host + url, type,
                function (options) {
                    if ($ConfinedSpacemanagement.EquipmenFacilities.length == 0) {
                        $ConfinedSpacemanagement.InitArray();
                    }
                    var p = JSON.parse(options.body);
                    //条件
                    var ConfinedSpaceName = getDicValue("06", p.model.Department);
                    var Number = p.model.Number;
                    var Department = getDicValue("14", p.model.Department);
                    var Location = getDicValue("tl1", p.model.Department);
                    var RiskFactor = p.model.RiskFactor;
                    var StoredMedia = p.model.StoredMedia;
                    var offset = p.offset;
                    var limit = p.limit;
                    var limitUsers2 = [];
                    for (var i = 0; i < $ConfinedSpacemanagement.EquipmenFacilities.length; i++) {
                        var user = $ConfinedSpacemanagement.EquipmenFacilities[i];
                        if (ConfinedSpaceName && user.ConfinedSpaceName.indexOf(ConfinedSpaceName) == -1)
                            continue;
                        if (Number && user.Number.indexOf(Number) == -1)
                            continue;
                        if (Department && user.Department.indexOf(Department) == -1)
                            continue;
                        if (Location && user.Location.indexOf(Location) == -1)
                            continue;
                        if (RiskFactor && user.RiskFactor.indexOf(RiskFactor) == -1)
                            continue;
                        if (StoredMedia && user.StoredMedia.indexOf(StoredMedia) == -1)
                            continue;
                        user.ConfinedSpaceName = getDicValue("06", user.ConfinedSpaceName) == '' ? user.ConfinedSpaceName : getDicValue("06", user.ConfinedSpaceName);
                        user.Department = getDicValue("14", user.Department) == '' ? user.Department : getDicValue("14", user.Department);
                        user.Location = getDicValue("tl1", user.Location) == '' ? user.Location : getDicValue("tl1", user.Location);
                        limitUsers2.push(user);
                    }

                    var limitUsers = [];
                    for (var i = 0; i < limitUsers2.length; i++) {
                        if (i < offset + limit && i >= offset) {
                            limitUsers.push(limitUsers2[i]);
                        }
                    }
                    return {
                        result: "Success", message: null,
                        data: { pageData: limitUsers, rowCount: limitUsers2.length }
                    };
                }); break;
            ////获取Input数据
            case '/api/ConfinedSpacemanagement/get': Mock.mock(host + url + '?' + param, type, function (options) {

                var myUsers = parent.$ConfinedSpacemanagement.EquipmenFacilities;
                myuser = {};
                for (var i = 0; i < myUsers.length; i++) {
                    if (myUsers[i].id == vueApp.id) {
                        myuser = myUsers[i];
                        break;
                    }
                }
                myuser.ConstructionCategory = getDicKey("25", myuser.ConstructionCategory);
                return {
                    result: "Success", message: null, data: myuser
                };
            }); break;
            ////提交
            case '/api/ConfinedSpacemanagement/Save': Mock.mock(host + url, type, function (options) {
                var thisuser = JSON.parse(options.body);
                var thisUsers = parent.$ConfinedSpacemanagement.EquipmenFacilities;
                var cz = true;
                for (var i = 0; i < thisUsers.length; i++) {
                    if (thisUsers[i].id == thisuser.id) {
                        thisUsers[i].Department = thisuser.Department;
                        thisUsers[i].Number = thisuser.Number;
                        thisUsers[i].ConfinedSpaceName = thisuser.ConfinedSpaceName;
                        thisUsers[i].Location = thisuser.Location;
                        thisUsers[i].StoredMedia = thisuser.StoredMedia;
                        thisUsers[i].RiskFactor = thisuser.RiskFactor;
                        thisUsers[i].Remarks = thisuser.Remarks;
                        cz = false;
                        break;
                    }
                }
                if (cz) {
                    //Input 页面需要 去操作List页面的数组 parent
                    parent.$ConfinedSpacemanagement.EquipmenFacilities.push({
                        id: thisuser.id,
                        Department: thisuser.Department,
                        Number: thisuser.Number,
                        ConfinedSpaceName: thisuser.ConfinedSpaceName,
                        Location: thisuser.Location,
                        StoredMedia: thisuser.StoredMedia,
                        RiskFactor: thisuser.RiskFactor,
                        Remarks: thisuser.Remarks,

                    });
                }
                return { result: "Success", message: null, data: null };
            }); break;
        }
    },
    EquipmenFacilities: [],
    InitArray: function () {
        for (var i = 0; i < 80; i++) {
            $ConfinedSpacemanagement.EquipmenFacilities.push(Mock.mock({
                id: Mock.Random.id(),
                Department: randomValue('14'),//"部门",
                Number: Mock.Random.id(),
                ConfinedSpaceName: randomValue('06'),
                Location: randomValue('97'),
                StoredMedia: randomValue('n115'),
                RiskFactor: randomValue('n114'),
                Remarks: Mock.mock('@cparagraph(1, 1)'),

            }));
        }
    }
}
